How do I add relative points to a sketch? (& bonus question: which way is up?)

How do I add relative points to a sketch? (& bonus question: which way is up?)

OceanHydroAU
Collaborator Collaborator
473 Views
1 Reply
Message 1 of 2

How do I add relative points to a sketch? (& bonus question: which way is up?)

OceanHydroAU
Collaborator
Collaborator

I think I've stumbled into a wrong corner - can someone please point me in the right direction?

 

I'm wanting to add many related points, so I can later-on draw a fit-point-spline around them:

for i in range(0,len(splinex)-1):
    points.add(adsk.core.Point3D.create(splinex[i]*scale+nose_x, spliney[i]*scale+nose_y,0.0))

it occurs to me this seems wrong.  I'm not telling it that all these are related to each other, like I mean them to be. They should all be "constrained" by being either "a set distance and angle away from each other"  or by being "corners of a rectangle of dimensions delta-x and delta-y" - or however-else relative information is best added (suggestions?).  In addition, the "last" point connects to the first to close the shape.  My user also selects the first point (nose_x,nose_y) which anchors all that stuff into their sketch.

 

So, two questions:-

 

a) what am I supposed to be doing to add new points which are related to previous ones ?

 

b) how do I turn all these points into construction points instead of "real" points (there's a lot of them, and they look messy and pollute the results.)

 

And a third question for good luck...

 

c) on the off-chance that my user defined a sketch that's on some whacky odd-oriented plane, is there some easy shortcut I can use to place my 2-dimensional points onto that plan using just X and Y?  Or, do I have to do all the translation/rotation math myself to work out the actual X,Y,Z and try to figure out which way the user means is "up" ?

 

Also worth keeping in mind - when I tried to "loft" between 2 of these, bizarreness resulted = fusion360 seemed to arbitrarily select a few points on each shape which were not opposite each other, resulting in a weird twisted mess - so anything I should be doing so the loft tool understands where stuff starts and ends would be worth knowing.

 

Screen Shot 2020-05-12 at 4.42.28 pm.png

0 Likes
474 Views
1 Reply
Reply (1)
Message 2 of 2

OceanHydroAU
Collaborator
Collaborator

I've worked part way to my answer so far.

 

This works for X (And similar for Y) relative points:

rh=d.addDistanceDimension(nose, sp, adsk.fusion.DimensionOrientations.HorizontalDimensionOrientation, sp.geometry)
rh.parameter.expression='{} cm'.format(splinex[i]*scale)

 

Note two "gotchas":

a) you can't use negative expressions 😞

b) if any of the points you added happened to coincide with any existing geometry, Fusion 360 will have "helpfully" added its own constraints for you (or possibly discarded your point and used the existing one it found) - so you can't add *more* constraints if it did that. 

 

 

There are no such things as "construction points".  All points are just points.

 

 

"Which way is up" - that's easy - every sketch is relative, so in the API, Y is always up, X is sideways, and there's no "Z" usually).  Fusion 360 takes care of reorienting whatever you sketched into whatever whacky orientation your sketch plane was on later.

0 Likes