'建立装配基准面 '建立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面上