Sketches on plane along a spline

Sketches on plane along a spline

ione_ianniruberto
Contributor Contributor
533 Views
2 Replies
Message 1 of 3

Sketches on plane along a spline

ione_ianniruberto
Contributor
Contributor

Hi, I have created a plane along a spline like in the figure. Now I want to create a sketch on this plane. I create the circle in the plane and as the center of the circle I want specifically the point of the spline in corrspodence of which the plane has been created. I try to put zero but the code gives the result in the figure. The code that I wrote is this:

spline = sketchnurb.sketchCurves.sketchFittedSplines.add(points)
distance0 = adsk.core.ValueInput.createByReal(0.0)
planeInput.setByDistanceOnPath(spline, distance0)
plane0 = planes.add(planeInput)
sketchplane0 = rootComp.sketches.add(plane0) #PianoVALVE
circleplane0 = sketchplane0.sketchCurves.sketchCircles
               
circle01 = circleplane0.addByCenterRadius(adsk.core.Point3D.create(0,0,0), 0.85)
circle02 = circleplane0.addByCenterRadius(adsk.core.Point3D.create(0,0,0), 1.05)
profilo01 = sketchplane0.profiles.item(0)
profilo02 = sketchplane0.profiles.item(1)

ione_ianniruberto_0-1699101441443.png

I don't know what else to do. Can someone please help me?

Thanks

Ione  

 

 

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

doge0161
Participant
Participant
Accepted solution

For some reason, the origin of the construction plane is not created on the spline. I'm sure there's a reason for this but it's not evident to me.

 

However, there is a workaround. If you replace these lines

 

circle01 = circleplane0.addByCenterRadius(adsk.core.Point3D.create(0,0,0), 0.85)
circle02 = circleplane0.addByCenterRadius(adsk.core.Point3D.create(0,0,0), 1.05)

 

with this

 

circle01 = circleplane0.addByCenterRadius(sketchplane0.modelToSketchSpace(plane0.geometry.origin), 0.85)
circle02 = circleplane0.addByCenterRadius(sketchplane0.modelToSketchSpace(plane0.geometry.origin), 1.05)

 

you should achieve the desired result. This substitutes the centerpoint with the origin of the construction plane which is in fact on the spline.

Sample screenshot:

Screenshot 2023-11-04 173141.png

 

 

 

 

 

 

 

 

 

 

I Hope this helps!

Message 3 of 3

ione_ianniruberto
Contributor
Contributor

Thanks so much!