zoukankan      html  css  js  c++  java
  • Solidworks API中在一个拉伸的矩形的前后面建立两个基准面的代码示例

     '建立装配基准面
            '建立Top Plane
            boolstatus = swDoc.Extension.SelectByID2("", "FACE", 0, 0, 0, True, 0, Nothing, 0)
            myRefPlane = CType(swDoc.FeatureManager.InsertRefPlane(8, 0, 0, 0, 0, 0), RefPlane)
            boolstatus = swDoc.Extension.SelectByID2("Plane1", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
            boolstatus = swDoc.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "RefTopPlane")
            swDoc.ClearSelection2(True) '此行代码保留
            '建立Bottom Plane 保留z轴空间坐标尺寸
            boolstatus = swDoc.Extension.SelectByID2("", "FACE", 0, 0, txt_M_I_Thickness.Text / 1000, True, 0, Nothing, 0)
            myRefPlane = CType(swDoc.FeatureManager.InsertRefPlane(8, 0, 0, 0, 0, 0), RefPlane)
            boolstatus = swDoc.Extension.SelectByID2("Plane2", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
            boolstatus = swDoc.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "RefBottomPlane")
            '选择基准面并隐藏
            boolstatus = swDoc.Extension.SelectByID2("RefTopPlane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
            boolstatus = swDoc.Extension.SelectByID2("RefBottomPlane", "PLANE", 0, 0, 0, True, 0, Nothing, 0)
            boolstatus = swDoc.Extension.SelectByID2("RefBottomPlane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
            swDoc.BlankRefGeom()
            '保存文件
            longstatus = swDoc.SaveAs("d:lsolation Plate.SLDPRT")
            swApp.CloseDoc("lsolation Plate.SLDPRT")

    在这里要注意的是当建立第二个面的时候要选择后面并在前面的拉伸高低值付给: 

    boolstatus = swDoc.Extension.SelectByID2("", "FACE", 0, 0, txt_M_I_Thickness.Text / 1000, True, 0, Nothing, 0)

    如果 txt_M_I_Thickness.Text / 1000 的值 =0的话就会产生建的连个基准面都在top面上

      

  • 相关阅读:
    传的参数乱码
    Tp5.0中分页加搜索的用法!!!
    TP5.0循环更新数据问题
    TP5.0中foreach里面使用save方法变成更新问题
    TP5.0中软删除的用法
    TP5.0中save方法加主键id的用法!!!
    用宝塔的定时任务写shell命令会以root执行的解决方法
    兆易创新RISC-V开发板评测
    使用vsCode配合IAR搭建arm开发环境
    Vue 路由导航解析流程
  • 原文地址:https://www.cnblogs.com/frankwu2014/p/3650110.html
Copyright © 2011-2022 走看看