Message 1 of 2
How do I create equal distance chamfer without manually selecting it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I was wondering how does one can create a chamfer feature without having to manually select the edge. I have already a python script which pre-determine the diameter, extrusion, of a part. I would like to have everything in one script rather than 2.
Suppose you have a flat washer and you desired to add a chamfer on either internal edges.
Basically, I want to get from this:
to this final product
Knowing there are only 4 edges (2 external and 2 internal), how do I specify on either internal edges?
Below is my current script to generate the basically washer, aka orifice plate. The API sample given by Autodesk does indeed work, but you have to select it. In my case I want to automate it.
# -*- coding: utf-8 -*- """ Created on Fri Jun 28 06:08:52 2019 @author: Richard """ print ("\n"*80) ################################################# # # # Some functions to make main code easier # # to read # # # ################################################# def iteration_coefficient(C2, D2, Condition_0, Condition_1, Condition_2): i=1 while C2/D2 > 0.04: C2=0.99*C2 i+=1 #print(str(i)) print('Il y a eu '+str(i)+ " itération(s)") return C2 # UNIT IN INCHES BY DEFAULT ########################################### # # VARIABLES TO CHOOSE # D1 diameter of main pipe in INCHES # D2 Orifice diameter in INCHES ########################################## D1=1.029 D2=0.5 D_hors_tout_orifice=1.5 epaisseur=0.1 ######################################### # # # Governing parameters! Do not change # ######################################### Condition_0= 1/30*D1 Condition_1= 1/8*D2 Condition_2= 1/4* (D1-D2)/2 C_hypothese=0.04*D2 C2= min([Condition_0, Condition_1, Condition_2, C_hypothese]) print('La premiere condition 0C est:'+ str(Condition_0)+'"') print('La deuxième condition 1C est:'+ str(Condition_1)+'"') print('La troisième condition 2C est:'+ str(Condition_2)+'"') print('La Condition hypothèse est:'+ str(C_hypothese)+'"') print('') print('') print('C2 doit être au moins plus petit que: '+ str(C2)+'"') print('') ########################################## # # # LEADING EDGE THICKNESS CONDITION # ######################################### #Méthode facile Facile=True if Facile==True and C2/D2 <= 0.04: print('Le ratio C2 suggéré est :'+ str(C2)+'"') else: if C2/D2 > 0.04: print('Le ratio C2/D2 est trop grand:'+ str(C2/D2)) C2=iteration_coefficient(C2, D2, Condition_0, Condition_1, Condition_2) print('Le ratio C2 suggéré est :'+ str(C2)+'"') else: print('Le ratio C2/D2 est acceptable:'+ str(C2/D2)) ############################################################# # # # FUSION API FROM PYTHON # # DEFAULT UNITS IN CM # ############################################################# import adsk.core, adsk.fusion, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType) design = app.activeProduct # Get the root component of the active design. rootComp = design.rootComponent # Create a new sketch on the xy plane. sketches = rootComp.sketches xyPlane = rootComp.xYConstructionPlane sketch = sketches.add(xyPlane) # Draw some circles. circles = sketch.sketchCurves.sketchCircles circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), D_hors_tout_orifice*2.54) # Add a circle at the center of one of the existing circles. circle2 = circles.addByCenterRadius(circle1.centerSketchPoint, D2*2.54) # Get the profile defined by the circle. prof = sketch.profiles.item(0) # Define that the extent is a distance extent of 5 cm. distance = adsk.core.ValueInput.createByReal(epaisseur*2.54) # Create the extrusion. extrudes = rootComp.features.extrudeFeatures ext = extrudes.addSimple(prof, distance, adsk.fusion.FeatureOperations.NewComponentFeatureOperation) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))