|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
简单地画3个圆,这3个圆都要拉伸为圆柱,而且要同心。我是给定它们的圆心坐标以保持同心。
但是由于对 SOLIDWORKS二次开发不熟悉,所以请教各位,谢谢!
Boolean boolstatus;
SldWorks.IModelDoc2 ModDoc;
SldWorks.SldWorks swApp = new SldWorks.SldWorksClass();
SldWorks.IPartDoc PrtDoc = swApp.INewPart();
ModDoc = swApp.IActivateDoc3("", true, ref IErrors);
ModDoc.ViewDisplayHiddengreyed();
ModDoc.SetAddToDB(true);
swApp.SetUserPreferenceToggle(60, false);
ModDoc.SetTitle2("辊坯1");
SldWorks.IFeatureManager FeatMrg = ModDoc.FeatureManager;
Boolean flag = ModDoc.SelectByID("前视", "PLANE", 0, 0, 0);
ModDoc.InsertSketch();
ModDoc.ICreateCircleByRadius2(3, 3, 0, 0.7);
ModDoc.InsertSketch();
ModDoc.FeatureBoss2(false, true, false, 0, 0, 2.5, 2.5, false, false, false, false, 0, 0, false, false, false, false);
ModDoc.SelectByID("", "FACE", 3, 3, 2.5);
ModDoc.InsertSketch();
ModDoc.ICreateCircleByRadius2(3, 3, 2.5, 0.2);
ModDoc.InsertSketch();
ModDoc.FeatureBoss2(true, true, false, 0, 0, 0.5, 0, false, false, false, false, 0, 0, false, false, false, false);
ModDoc.ClearSelection();
//问题是下面这个给的圆心坐标到solidworks里面就不一样了,(3,3,-2.5)到solidworks里面就是(-3,3,-2.5),
//如果把InsertSketch改成Insert3DSketch的话,ICreateCircleByRadius2就出错。
flag = ModDoc.SelectByID("前视", "PLANE", 0, 0, 0);
ModDoc.SelectByID("", "FACE", 3, 3, -2.5);
ModDoc.InsertSketch();
ModDoc.ICreateCircleByRadius2(3, 3, -2.5, 0.2);
ModDoc.InsertSketch();
ModDoc.FeatureBoss2(true, true, false, 0, 0, 0.5, 0, false, false, false, false, 0, 0, false, false, false, false);
swApp.Visible = true; |
|