for the boyz

This commit is contained in:
2022-10-15 19:16:08 +02:00
commit 9fe266ca3a
8188 changed files with 1567766 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"pathMappings": [ {
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}"}],
"osx": {"filePath":"${file}"},
"windows": {"filePath":"${file}"},
"port": 9000,
"host": "localhost"
}
]
}
@@ -0,0 +1,9 @@
{
"autodeskProduct": "Fusion360",
"type": "script",
"author": "",
"description": {
"": ""
},
"supportedOS": "windows|mac"
}
+78
View File
@@ -0,0 +1,78 @@
#Author-Autodesk Inc.
#Description-Select a path to create a pipe.
import adsk.core, adsk.fusion, traceback
pipeRadius = 2.5
pipeThickness = '5mm'
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
if not design:
ui.messageBox('It is not supported in current workspace, please change to MODEL workspace and try again.')
return
sel = ui.selectEntity('Select a path to create a pipe', 'Edges,SketchCurves')
selObj = sel.entity
comp = design.rootComponent
# create path
feats = comp.features
chainedOption = adsk.fusion.ChainedCurveOptions.connectedChainedCurves
if adsk.fusion.BRepEdge.cast(selObj):
chainedOption = adsk.fusion.ChainedCurveOptions.tangentChainedCurves
path = adsk.fusion.Path.create(selObj, chainedOption)
path = feats.createPath(selObj)
# create profile
planes = comp.constructionPlanes
planeInput = planes.createInput()
planeInput.setByDistanceOnPath(selObj, adsk.core.ValueInput.createByReal(0))
plane = planes.add(planeInput)
sketches = comp.sketches
sketch = sketches.add(plane)
center = plane.geometry.origin
center = sketch.modelToSketchSpace(center)
sketch.sketchCurves.sketchCircles.addByCenterRadius(center, pipeRadius)
profile = sketch.profiles[0]
# create sweep
sweepFeats = feats.sweepFeatures
sweepInput = sweepFeats.createInput(profile, path, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
sweepInput.orientation = adsk.fusion.SweepOrientationTypes.PerpendicularOrientationType
sweepFeat = sweepFeats.add(sweepInput)
# create shell
startFaces = sweepFeat.startFaces
endFaces = sweepFeat.endFaces
objCol = adsk.core.ObjectCollection.create()
for startFace in startFaces:
objCol.add(startFace)
for endFace in endFaces:
objCol.add(endFace)
if objCol.count == 0:
bodies = sweepFeat.bodies
for body in bodies:
objCol.add(body)
shellFeats = feats.shellFeatures
shellInput = shellFeats.createInput(objCol, False)
shellInput.insideThickness = adsk.core.ValueInput.createByString(pipeThickness)
shellFeats.add(shellInput)
app.activeViewport.refresh()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))