I used the SW macro recorder to create a rectangle with equal length constraints, extruded to 0.1in. sketched a line on the same face as the extrude sketch and with the sketch still open, used it to insert a split line. I ran the macro and it worked perfectly and prompted me for the desired size.
I've attached a copy of the macro that was generated for reference. Post your macro using the advanced editor so others can take a look and provide you with solutions. Otherwise I can walk you through the command steps I used to create mine, since I am not a master of the SW API
Macro_splitline_test.swp.zip 6.9 KB
Thanks for your quick response.
I just tried your macro and it works perfectly.
Unfortunately, I tried the same way but seems it does't work in my C# macro.
When I use "Insert3DSketch", I could create a line successfully.
But when I use "InsertSketch", the line doesn't show up.
I attached my macro, could you please have a look at it?
Before you run it, please "Create a new document" for "Part".
Thanks a lot.
macro.zip 1.5 MB
Finally I fix this problem.
But I think there is an "typo" in the API documentation.
the order of parameter in CreateLine() is X1, Z1, Y1, X2, Z2, Y2, not X Y Z....
Thanks for your help.
All the best