I’m making a bunch of macros that allow me to draw different objects faster. when I use the trim command I have a specific coordinate that the line I need to trim is on. When I use the trim command with coordinates in the macro while I’m zoomed out to see the coordinate it works just fine, but if I’m zoomed in and the coordinate is offscreen the trim command starts off the coordinate I gave it and starts a box instead of trimming the line. Any idea why that is or how to make it more precise?
can you post your macro as it sits atm? @pascal is a wizard when it comes to diagnosing this stuff.
Oi… I do not see how that can work if the trim location is out of view… maybe a Zoom Extents in the macro…? I guess a file and your macro would be good to have to try to come up with something helpful - it seems like you are headed for scripting territory.
Its for making half of a base for a weldable part.
put in diameter–enter
click on the right half of each circle to trim
than if you’re zoomed out enough it will trim the black vertical line, if you are zoomed in it misses the coordinate.
!_Circle 0,0 _Pause _SelLast
_Offset _Pause _Pause 20,0
_Polyline .5,-30 .5,30 _Enter _SelLast
_Trim _Pause _Pause _Pause _Enter _Invert
_Trim .5,29 _Pause _Enter
_Trim .5,-29 _Pause _Enter
_Trim .5,0 _Pause _Enter
also I wasn’t able to use the same trim command to trim multiple points like you can using the command on its own, hint the reason there’s three trim commands.
Yeah, I think a Zoom Extents in the middle does it:
!_Circle 0,0 _Pause _SelLast _Offset 20,0 _Polyline .5,-30 .5,30 _Enter _SelLast _Trim _Pause _Pause _Pause _Enter _Invert ZE _Trim .5,29 _Pause _Enter _Trim .5,-29 _Pause _Enter _Trim .5,0 _Pause _Enter
But, a bit of scripting might go a long way…
Is there a way to zoom it back to where it was? We make a lot of different sizes of these parts and I’m not always the one doing it.
What do you mean a bit of scripting? I’m new to the whole macro/python thing, its a process.
I’m trying to learn a little of the rhino python so I can try to make it even easier, but I’m not sure if that will even let me do what I really want.
Hi Nathan - use UndoView at the end, that will undo the ZE part:
!_Circle 0,0 _Pause _SelLast _Offset 20,0 _Polyline .5,-30 .5,30 _Enter _SelLast _Trim _Pause _Pause _Pause _Enter _Invert ZE _Trim .5,29 _Pause _Enter _Trim .5,-29 _Pause _Enter _Trim .5,0 _Pause _Enter UndoView
But, on the scripting front - it will almost certainly allow you to do what you want - is this macro a ‘finished’ example?
e.g. @Nathan_Miller I do not know if this really does what you need but just by way of example -
Part.py (1.7 KB)
To use the Python script use
RunPythonScript, or a macro:
_-RunPythonScript "Full path to py file inside double-quotes"
That script is awesome. the macro I sent was not complete, it also involves importing a tab from the parts library and you have to manually place it, then it moves the part and starts the export process. trying to put in the location to place that tab on the outside circle at x=0 and trimmed is the part I’m worried about. If all those steps can be put in to run automatically than its just tweaking numbers and adding inputs for offset size.
I currently have 8 macros I’m trying to clean up, if i can get down how python works and learn the scripting than that would make things so much easier than writing out step by step instructions and hoping people can make it correctly.
Hi Nathan - again, not sure if this is really it but just one more to demo what you can do in a script - currently it only works if the incoming tab file has a closed curve but with a bit more typing could work with the open one as well.
Part.py (2.3 KB)
Tab2Closed.3dm (33.4 KB)
It does most of what I’m trying to do, and I think I understand what’s happening in the script. Is it possible to simply move the tab to the point where crv2 (outside crv I believe) intersects z0 axis? I’m trying to specify that point without using the y axis because that variable can change depending on the size of the part.
I’ve got the part to be able to move from crv2.PointAtStart and I just have to click where to place it, is there a way to simply move it .5" back on the z axis to 0 using the script itself?
The amount of steps in the script doesn’t matter, as long as it does everything, so adding lines or steps is not an issue.
Hi Nathan - try this one -
Part.py (2.3 KB)
Thank you very much, I wasn’t thinking far enough back in the code on what to change to get the tab in the right spot. I was able to modify the script with user inputs and auto import the tab so its all done.
1 of 8 down, Now onto the hard stuff.
One last question, I got the script set up how i want it but Im trying to export the file in a generated name based on the user inputs. (diam)x(flan)f round split base.dxf, ex “7x6f round split base.dxf”.
I know I’m probably just getting picky now but this is a lot of fun seeing what scripting can do. I appreciate all your help
RoundSplitBase.py (2.8 KB)
Hi Nathan - you can try this -
RoundSplitBase_PG.py (3.0 KB)
Hopefully that will give you something to work off of.
Nice. I don’t know how you do it (yet) but that’s perfect for that part. I’m going to do my best to learn from that to make the others. I appreciate your help and time.