Sketch rectangle and Extrude

Sketch rectangle and Extrude

info83PHN
Advocate Advocate
537 Views
1 Reply
Message 1 of 2

Sketch rectangle and Extrude

info83PHN
Advocate
Advocate

Stuck trying to create a sketch, add a rectangle, and extrude.

 

What am I missing ?

 

                # Create a new sketch on the xy plane.
                sketches = rootComp.sketches
                xyPlane = rootComp.xYConstructionPlane
                sketch = sketches.add(xyPlane)
                sketch.name = 'Dot Bridge ' + str(uLetterCount) + ' - ' + uLetter

                uPointA = adsk.core.Point3D.create(posMaxX + 0.115, 0.1, 0)
                uPointB = adsk.core.Point3D.create(posMaxX + 0.115 + 0.22, -1.5, 0)
                uBridge = sketch.addTwoPointRectangle(uPointA, uPointB)

                # Create an extrusion input
                extrudes = rootComp.features.extrudeFeatures
                extInput = extrudes.createInput(uBridge, adsk.fusion.FeatureOperations.JoinFeatureOperation)
                distance = adsk.core.ValueInput.createByReal(uDotJoinHeight)
                extInput.setDistanceExtent(False, distance)
                extInput.isSolid = True
                # Create the extrusion and add to timeline
                ext = extrudes.add(extInput)
0 Likes
Accepted solutions (1)
538 Views
1 Reply
Reply (1)
Message 2 of 2

info83PHN
Advocate
Advocate
Accepted solution

always manage to solve these just after posting. lol. Here's the code that worked if it helps anyone else

 

                # Create a new sketch on the xy plane.
                sketches2 = rootComp.sketches
                xyPlane2 = rootComp.xYConstructionPlane
                sketch2 = sketches2.add(xyPlane)
                sketch2.name = 'Dot Bridge ' + str(uLetterCount) + ' - ' + uLetter

                uPointA = adsk.core.Point3D.create(posMaxX + 0.115, 1.5, 0)
                uPointB = adsk.core.Point3D.create(posMaxX + 0.115 + 0.22, 0.5, 0)

                uBridge = sketch2.sketchCurves.sketchLines.addTwoPointRectangle(uPointA, uPointB)
                uExtrude = sketch2.profiles.item(0)

                # Create an extrusion input
                extrudes = rootComp.features.extrudeFeatures
                extInput = extrudes.createInput(uExtrude, adsk.fusion.FeatureOperations.JoinFeatureOperation)
                distance = adsk.core.ValueInput.createByReal(uDotJoinHeight)
                extInput.setDistanceExtent(False, distance)
                extInput.isSolid = True
                # Create the extrusion and add to timeline
                ext = extrudes.add(extInput)
0 Likes