Hi @AbeFM
I added a small README with some more info on how to use it here https://github.com/Orvillebe/Fusion360Scripting/tree/master/AddIns/StampButton
At the moment I created it to be used specifically together with the updateOnSave addins (see https://github.com/Orvillebe/Fusion360Scripting/tree/master/AddIns) But this could be changed (see POSSIBLE CHANGES in README)
If you would like to change it to be used independently then the following could be useful to know.
This part (below) decides what the user gets to chose from, so if you would want to be able to let the user chose other inputs to stamp you should change this part. Maybe change it to a textInput for free text.
#Dropdown of parameters
dropDownInput = inputs.addDropDownCommandInput("selectedParameter", "Parameter", adsk.core.DropDownStyles.TextListDropDownStyle)
dropDownItems = dropDownInput.listItems
dropDownItems.add("Version Number", True)
for parameter in design.userParameters:
dropDownItems.add(parameter.name, False)
You would need to do the same thing for inputs like font, size and depth if you would want you user to choose them. Have a look into this if you want to add other inputs for the user: http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-8B9041D5-75CC-4515-B4BB-4CF2CD5BC359
The font, size and depth are hardcoded at the moment because they do not matter for my use case. If you would like to change that you need to update the StampOnPlanarFace method.
#create sketch and text to stamp
stamp = self.writeOnPlanarFace(selectedFace, stamp)
#stamp the text
extrudes = stamp.parentSketch.parentComponent.features.extrudeFeatures
extrudeInput = extrudes.createInput(stamp, adsk.fusion.FeatureOperations.CutFeatureOperation)
distance = adsk.core.ValueInput.createByReal(-0.04)
extrudeInput.setDistanceExtent(False, distance)
extrudes.add(extrudeInput)
I will probably add the depth as a user input somewhere in the future (with a default value). But I am not sure when I am going to do this. I am also still looking into fitting the stamp snugly onto the face. At the moment I am using a point of which I am certain it will be on the face but if the face is small and the stamp big, the end sometimes falls off. Easy to fix by dragging but still a bit annoying. I had a look into bounding boxes which works perfectly for rectangular shapes but for other shapes not so much. Still the stamp drags easily around.
Hope this helps. Feel free to ask otherwise.
Cheers,
Orville