solidworks建立三维模型里面的几何对象和工程图里面的元素的联系

本文是帮助里面的一个例子,

首先打开一个三维模型和对应的工程图,保持三维模型为当前激活窗口,在三维模型里面选中一个面或者一个边,然后运行下面的代码,

会将工程图里面的第一视图里面对应的投影元素的线型的宽度改成4

main( )

{

SldWorks App = new SldWorks();
App.Visible = true; ModelDoc2 swModel = App.ActiveDoc;
SelectionMgr swSelMgr = swModel.SelectionManager;
object swEnt = swSelMgr.GetSelectedObject5() as Face2; int lErrorActivatingDoc = ;
string path = @"C:\Users\Administrator\Desktop\零件2.SLDDRW";
DrawingDoc swDrawing = App.ActivateDoc2(path, false, ref lErrorActivatingDoc) as DrawingDoc; SolidWorks.Interop.sldworks.View firstView = swDrawing.GetFirstView();
firstView = firstView.GetNextView(); Face2 face = swEnt as Face2;
var edges = face.GetEdges();
foreach (Edge ee in edges)
{
bool bRet = firstView.SelectEntity(ee, false);
swDrawing.SetLineWidth();
} }
上一篇:使用Fragment创建灵活的用户界面


下一篇:mitmproxy