Spline Constraint

Spline Constraint

dozerdroid
Enthusiast Enthusiast
562 Views
2 Replies
Message 1 of 3

Spline Constraint

dozerdroid
Enthusiast
Enthusiast

Hi, I have been creating splines for hull section shapes as below 

0.PNG1.PNG

And it's working fine except I need a horizontal constraint at the bottom of the hull, if I manually click and add the constraint it works fine as shown below

2.PNG

But of course I need to do this programatically .. so I have been experimenting like below

 

constraints = sketch.geometricConstraints

constraints.addHorizontalPoints(point)

 

but i can't seem to make it work ? if you have any pointers or suggestions it would be most appreciated, thx Khim

 

0 Likes
Accepted solutions (1)
563 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

The constraint is added to a line that controls the tangent at that fit point. It's possible to do that through the API too. Here's some code that demonstrates creating a spline, getting the line that controls the tangent at the start of the spline and adding the horizontal constraint.

sk: adsk.fusion.Sketch = root.sketches.add(root.xYConstructionPlane)

points = adsk.core.ObjectCollection.create()
points.add(adsk.core.Point3D.create(0, 0, 0))
points.add(adsk.core.Point3D.create(5, 2, 0))
points.add(adsk.core.Point3D.create(8, 5, 0))
points.add(adsk.core.Point3D.create(12, 2, 0))
points.add(adsk.core.Point3D.create(18, 5, 0))
spline = sk.sketchCurves.sketchFittedSplines.add(points)

tanLine = spline.activateTangentHandle(spline.startSketchPoint)

sk.geometricConstraints.addHorizontal(tanLine)
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

dozerdroid
Enthusiast
Enthusiast

Ths for the help, Khim 

0 Likes