Creating Arcs
-
Anyone have problems with
@entities.add_arc, andselection.add_arc? I am using Acad's dxf definition of arc for starting, and ending angle, but am getting a circle, not an arc.vector = Geom;;Vector3d.new 0,0,1 @vector2 = Geom;;Vector3d.new 1,0,0 @vector3 = vector.normalize! . . . my_arc = @entities.add_arc [@entity[0],@entity[1],@entity[2]], @vector2, @vector3, @entity[3], @entity[4], @entity[5], 24Am I too tired to see the obvious?-) Hanging it up, and going to bed.
-
Check the data you are feeding the method.
-
There is only a
entities.add_arc(...)method - there isn't one for 'selection'
-
Thanks tt, and oops about my own typo TIG. I meant to write
status = entities.add_selection my_arc, wheremy_arc = @entities.add_arc [@entity[0],@entity[1],@entity[2]], @vector2, @vector3, @entity[3], @entity[4], @entity[5], 24.>_< -
Finally got back to this, and checked data as suggested. I had to rotate the normalized z and x axis, and convert my data to radians. Too bad the API is not set up for beginners, or Architects:-) Now on to calculate the default number of line segments for arcs.
my_arc = @entities.add_arc [@entity[0]+@block_x,@entity[1]+@block_y,@entity[2]+@block_z], @vector2, @vector3, @entity[3], @entity[4]*(Math::PI/180), @entity[5]*(Math::PI/180), 24 -
There are methods to convert between degrees and radians:
http://code.google.com/apis/sketchup/docs/ourdoc/numeric.htmlFrom radians to degrees:
1.22.radiansFrom degrees to radians:
30.degrees -
Well, I finally took the time to make this really work. Starting and finishing angles are measured in radians, measured counter clockwise from the +x axis. I needed to add 360 to the finishing angle.
When:
vector = Geom::Vector3d.new 0,0,1 @vector2 = Geom::Vector3d.new 1,0,0 @vector3 = vector.normalize!
The correct arc is drawn by:
my_arc = @entities.add_arc [@entity[0]+@block_x, @entity[1]+@block_y, @entity[2]+@block_z], @vector2, @vector3, @entity[3], (@entity[4]*Math::PI)/180, ((360+@entity[5])*Math::PI)/180@block_?is the location of the block/group from the origin. When an entity, its value is0.0, nothing.Only problem now, is that the data from my Cad's DxfOut, and Acad's seems to be different. I have to check the spec. by their version numbers, but I can't believe they have changed that much.>_< But "Oh well", that's why I am writting this s*^&&y app.:-)
Addenda: I found this variable tags 210, 220, and 230 (extrusion direction) wherein my Cad's DxfOut is
[0,0,-1], and the default Acad's is[0,0,1]. What's an extrusion direction?Addenda: z=-1 in [x,y,z] seems to mean that the arc is mirrored around the world view origin. It appears that when z=1 in [x,y,z], the arc is mirrored on the y axis, and set by (see the green (-)) below:
my_arc = @entities.add_arc [%(#008000)[-]@entity[0]+@block_x, @entity[1]+@block_y, @entity[2]+@block_z], @vector2, @vector3, @entity[3], (@entity[4]*Math::PI)/180, ((360+@entity[5])*Math::PI)/180
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement