One of the things that you can do is query a DRAWSEGMENT to determine its attributes. With the call command, you can get all the attributes at once. For example, select one or more DRAWSEGMENTs, then execute the following:
- drawings selected GetCenter,GetStart,GetEnd,GetRadius split call
You will get the results of each of those Python method calls on the selected objects.
With that in mind you can use the newdrawing command in an upcoming release of KiCommand to create basic objects. I’ve put together a few for testing. One thing I realized while testing is that the specification for ArcR–where you specify the Start point, End point, and radius–does not fully specify an ARC. For any two points and a given radius, there are four ARCs that start and end at those points. Namely Clockwise/Rightward with angle less than 180, Clockwise/Rightward with angle greater than 180, Counter-clockwise/Leftward with angle less than 180, Counter-clockwise/Leftward with angle greater than 180. Unfortunately this cannot be disambiguated with a sign on the radius. On the “bright” side, one of the main reasons I can think of why to use this specification of an Arc is to make sure the start and end point are at given locations, and the curvature is defined. More likely, however, you will find the round command more useful, as it will create an ARC between two lines, and make sure the connections are smooth–at the same angle–forming a smooth transition between line and ARC.
Another issue is with ArcP, where center, start, and end are specified. There are two ARCs that pass through the points. If a direction, either CW/RW or CCW/LW is assumed, then ArcP only specifies one ARC.
At this point, assume that the Arc* definitions might be changing.
Here are some of the commands I’ve used for testing. I haven’t verified all the conditions, particularly when internal calculations result in infinity (which happens with the slope calculation of a vertical line).
CircleR,mm,2,0,0,2,2 split newdrawing refresh
Line,mm,0,0,0,5 split newdrawing
CircleC,mm,20,5,2 split newdrawing
CircleR,mm,10,7,12,5,2 split newdrawing
CircleR,mm,8,5,10,3,2 split newdrawing refresh
CircleO,mm,7,5,5,7,5,3 split newdrawing
CircleP,mm,0,5,2,5 split newdrawing
ArcC,mm,0,0,2,0,361 split newdrawing
ArcC,mm,5,0,7,0,360 split newdrawing
ArcC,mm,10,0,12,0,359 split newdrawing
ArcC,mm,15,0,17,0,271 split newdrawing
ArcC,mm,20,0,22,0,270 split newdrawing
ArcC,mm,25,0,27,0,269 split newdrawing
ArcC,mm,30,0,32,0,181 split newdrawing
ArcC,mm,35,0,37,0,180 split newdrawing
ArcC,mm,40,0,42,0,179 split newdrawing
ArcC,mm,45,0,47,0,91 split newdrawing
ArcC,mm,50,0,52,0,90 split newdrawing
ArcC,mm,55,0,57,0,89 split newdrawing
ArcC,mm,60,0,62,0,1 split newdrawing
ArcC,mm,65,0,67,0,0 split newdrawing
ArcC,mm,70,0,72,0,-1 split newdrawing
ArcC,mm,75,0,77,0,-89 split newdrawing
ArcC,mm,80,0,82,0,-90 split newdrawing
ArcC,mm,85,0,87,0,-91 split newdrawing
ArcC,mm,90,0,92,0,-179 split newdrawing
ArcC,mm,95,0,97,0,-180 split newdrawing
ArcC,mm,100,0,102,0,-181 split newdrawing
ArcC,mm,105,0,107,0,-269 split newdrawing
ArcC,mm,110,0,112,0,-270 split newdrawing
ArcC,mm,115,0,117,0,-271 split newdrawing
ArcC,mm,120,0,122,0,-359 split newdrawing
ArcC,mm,125,0,127,0,-360 split newdrawing
ArcC,mm,130,0,132,0,-361 split newdrawing
ArcR,mm,25,7,25,3,2 split newdrawing
ArcO,mm,0,2,2,0,-2,0 split newdrawing "this has problem. should be start,mid,end"
ArcP,mm,0,0,2,0,-2,0 split newdrawing "CSE"
Polygon,mm,0,0,5,5,10,-10,15,15
Polyline,mm,0,0,5,5,10,-10,15,15
Bezier,mm,0,0,5,5,10,-5,15,0