AnsweredAssumed Answered

How to change corner treatment in weldments thru c# macro, i can choose and change only all corners and that is what i dont want. Can you tell me how to change only one corner ?

Question asked by Jaroslav Volček on Aug 19, 2017
Latest reply on Aug 21, 2017 by Manikandan Babu

How to change corner treatment in weldments thru c# macro, i can choose and change only all corners and that is what i dont want. Can you tell me how to change only one corner ? For all help, i will be gratefull.

 

This code do it only for all.

 


swSketchMgr = (SketchManager)swModel.SketchManager;

                sketchLines = (object)swSketchMgr.CreateCornerRectangle(0, 0, 0, 0.5, 0.5, 0);

                swModel.ClearSelection2(true);

              //  sketchLines = (object)swSketchMgr.CreateCornerRectangle(0.06513561531715, 0.03369083550887, 0, 0.1807053904567, -0.08106219210316, 0);

                swSketchMgr.InsertSketch(true);

                swModel.ViewZoomtofit2();

                swFeatureMgr = (FeatureManager)swModel.FeatureManager;

                swFeature = (Feature)swFeatureMgr.InsertWeldmentFeature();

                swStructuralMemberGroup1 = (StructuralMemberGroup)swFeatMgr.CreateStructuralMemberGroup();

                swModelDocExt = (ModelDocExtension)swModel.Extension;

                status = swModelDocExt.SelectByID2("Line1@Sketch1", "EXTSKETCHSEGMENT", 0.2, 0, 0, false, 0, null, 0);

                status = swModelDocExt.SelectByID2("Line2@Sketch1", "EXTSKETCHSEGMENT", 0, 0.2, 0, true, 0, null, 0);

                status = swModelDocExt.SelectByID2("Line3@Sketch1", "EXTSKETCHSEGMENT", 0.5, 0.2, 0, true, 0, null, 0);

                status = swModelDocExt.SelectByID2("Line4@Sketch1", "EXTSKETCHSEGMENT", 0.2, 0.5, 0, true, 0, null, 0);

                segs1[0] = (SketchSegment)swSelMgr.GetSelectedObject6(1, 0);

                segs1[1] = (SketchSegment)swSelMgr.GetSelectedObject6(2, 0);

                segs1[2] = (SketchSegment)swSelMgr.GetSelectedObject6(3, 0);

                segs1[3] = (SketchSegment)swSelMgr.GetSelectedObject6(4, 0);

                swStructuralMemberGroup1.Segments = segs1;

                swStructuralMemberGroup1.Angle = 0; //radians

                swStructuralMemberGroup1.ApplyCornerTreatment = true;

                swStructuralMemberGroup1.CornerTreatmentType = (int)swSolidworksWeldmentEndCondOptions_e.swEndConditionButt1;

                swStructuralMemberGroup1.MirrorProfile = true;

                swStructuralMemberGroup1.MirrorProfileAxis = (int)swMirrorProfileOrAlignmentAxis_e.swMirrorProfileOrAlignmentAxis_Vertical;

 

 

             

                groups1[0] = new DispatchWrapper((object)swStructuralMemberGroup1);

 

 

                weldmentProfile = "C:\\Users\\XXXX\\Desktop\\skuska\\nxn.SLDLFP";

                weldmentConfigurationName = "nxn";

                swFeature = (Feature)swFeatureMgr.InsertStructuralWeldment5(weldmentProfile, (int)swConnectedSegmentsOption_e.swConnectedSegments_SimpleCut, false, (groups1), weldmentConfigurationName);

                swModel.ClearSelection2(true);

 

 

 

i tried to select new group but it draw it one more time.

Outcomes