Intersecting Offset Curves

Intersecting Offset Curves

alongman1
Participant Participant
680 Views
3 Replies
Message 1 of 4

Intersecting Offset Curves

alongman1
Participant
Participant

Hi,  

I have created a file similar to the one below that slices a car body lengthwise, intersects the vehicle body with the plane, and offsets these curves by a predetermined height. I want to loft these profiles together to create a domain surrounding the vehicle (then subtract the vehicle body to capture the curvature and use this domain for fluid flow analysis). To create the loft well (simply lofting the profiles without rails creates odd, twisting geometry) I need rails, so the script below is supposed to create planes from the base of the vehicle to the top, intersect the previously offset curves (and then spline them later) however I cannot get the curves intersected with the sketch plane. The code for this section is below (for reference, 'xz' slides are slices along the y axis (the length of the body) and 'xy' slices are along the z (from the base to the top of the body): 

 

        planes = rootComp.constructionPlanes
        #create construction plane intput
        planeInput = planes.createInput()

        #get sketches
        sketches = rootComp.sketches


        carHeight = 74.5
        xySlices = 15
        xzSlices = 20
        Zmin = -14.5

        for i in range(xySlices😞
            z = Zmin + i*(carHeight/xySlices)
            offsetValue = adsk.core.ValueInput.createByReal(z)

            planeInput.setByOffset(rootComp.xYConstructionPlane, offsetValue)
            plane = planes.add(planeInput)
            plane.name = 'xyPlane'


            sketch = sketches.add(plane)
            sketch.name = 'xySketch'


            intEntities = []
            for i in range(xzSlices😞
                xzSketch =  sketches.item(i)
                numCurves = xzSketch.sketchCurves.count
                line0 = xzSketch.sketchCurves.item(numCurves-1)
                connectedCurve = xzSketch.findConnectedCurves(line0)
                intEntities.append(connectedCurve)

            sketchIntersect = sketch.intersectWithSketchPlane(intEntities)
 
The problem seems to be something wrong with the entities input into the intersectWithSketchPlane. 
 
Any help would be massively appreciated.
Thanks
Andrew

 

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

kandennti
Mentor
Mentor

Hi @alongman1 .

 

Recently @JeromeBriot  reported a problem with the intersectWithSketchPlane method.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/bug-intersectwithsketchplane-method-doesn-... 


It has not been resolved, but it may be due to the same thing.

0 Likes
Message 3 of 4

tykapl.breuil
Advocate
Advocate
Accepted solution

In the second to last line of your program you append the result of sketch.findConnectedCurves. However this method returns an objectCollection, try replacing this line with :

for curve in connectedCurves:
    intEntities.append(curve)

 

 

0 Likes
Message 4 of 4

alongman1
Participant
Participant

@tykapl.breuil Yes! That's worked, thank you so much. 

Andrew

0 Likes