
Not applicable
01-15-2020
02:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created a few surfaces with the TemporaryBRepManager that I would like to turn into a temporary BRep Solid.
They form a watertight volume. I haven't found how to turn them into a solid.
I don't see a method for that in the TemporaryBRep manager.
I have tried to use a Boundary fill feature but it seems to only work with real BRep Bodies, I am guessing its not the right tool for that.
How can I do this?
height = 15 width = 15 length = 100 module = 2 helixAngle = 0.349066 pressureAngle = 0.349066 app = adsk.core.Application.get() des = app.activeProduct root = des.rootComponent bodies = root.bRepBodies # Creating a base feature is the best option for doing direct modeling in an otherwise parametric design # Needs to be created, started and finished afterwards baseFeature = root.features.baseFeatures.add() baseFeature.startEdit() # The temporaryBRep manager is a tool for creating 3d geometry without the use of features # The word temporary referrs to the geometry being created being virtual, but It can easily be converted to actual geometry tbm = adsk.fusion.TemporaryBRepManager.get() #Array to keep track of TempBRepBodies tempBRepBodies = [] def rackLines(x ,y ,z , m, n, height, pAngle, hAngle): strech = 1/math.cos(hAngle) P = m * math.pi blsh = 0 lines = [] for i in range(n): # Root lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x + (i*P), y, z - 1.25 * m ), adsk.core.Point3D.create( x + (i*P) + (P/2) + blsh - (math.tan(pAngle) * 2.5 * m) , y, z - 1.25 * m )) ) # Left Edge lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x + (i*P) + (P/2) + blsh - (math.tan(pAngle) * 2.5 * m) , y, z - 1.25 * m ), adsk.core.Point3D.create( x + (i*P) + (P/2) + blsh - (math.tan(pAngle) * 0.25 * m) , y, z + m )) ) # Tip lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x + (i*P) + (P/2) + blsh - (math.tan(pAngle) * 0.25 * m) , y, z + m ), adsk.core.Point3D.create( x + (i*P) + P - blsh - (math.tan(pAngle)*2.25*m) , y, z + m )) ) # Right Edge lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x + (i*P) + P - blsh - (math.tan(pAngle)*2.25*m) , y, z + m ), adsk.core.Point3D.create( x + (i*P) + P, y, z - 1.25 * m )) ) # Right Edge lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x + (n*P), y, z - 1.25 * m ), adsk.core.Point3D.create( x + (n*P), y, z - height )) ) # Bottom Edge lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x + (n*P), y, z - height ), adsk.core.Point3D.create( x, y, z - height )) ) # Left Edge lines.append( adsk.core.Line3D.create(adsk.core.Point3D.create( x, y, z - height ), adsk.core.Point3D.create( x, y, z - 1.25 * m )) ) return lines # Creates BRep wire object(s), representing edges in 3D space from an array of 3Dcurves wireBody1, _ = tbm.createWireFromCurves(rackLines(0, 0, 0, module, 12, height, pressureAngle, helixAngle)) wireBody2, _ = tbm.createWireFromCurves(rackLines(0, width, 0, module, 12, height, pressureAngle, helixAngle)) # Creates a planar face from an array of Wires. face = tbm.createFaceFromPlanarWires([wireBody1]) tempBRepBodies.append(face) # Creates a planar face from an array of Wires. face = tbm.createFaceFromPlanarWires([wireBody2]) tempBRepBodies.append(face) surface = tbm.createRuledSurface(wireBody1.wires.item(0), wireBody2.wires.item(0)) tempBRepBodies.append(surface) tools = adsk.core.ObjectCollection.create() for b in tempBRepBodies: #tools.add(bodies.add(b, baseFeature)) tools.add(b) boundaryFills = root.features.boundaryFillFeatures boundaryFillInput = boundaryFills.createInput(tools, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) boundaryFillInput.targetBaseFeature = baseFeature print(boundaryFillInput.tools.count) cell = boundaryFillInput.bRepCells.item(0) cell.isSelected = True boundaryFills.add(boundaryFillInput) # Finishes the base feature baseFeature.finishEdit()
None 3 Traceback (most recent call last): File "/Users/nicoschluter/Library/Application Support/Autodesk/Autodesk Fusion 360/API/AddIns/RackTest/RackTest.py", line 184, in notify cell = boundaryFillInput.bRepCells.item(0) File "/Users/nicoschluter/Library/Application Support/Autodesk/webdeploy/production/1235e987d853b6f5773abdcdd7ff0ff6bea9a707/Autodesk Fusion 360.app/Contents/Api/Python/packages/adsk/fusion.py", line 3977, in item return _fusion.BRepCells_item(self, *args) RuntimeError: 2 : InternalValidationError : Xl::Utils::getObjectPath(object.get(), objPath, occurrence, contextPath)
Solved! Go to Solution.