Is there a square pipe script written in python?
I found this script, but RhinoScript does not work on the mac.
Is there a rewrite of this script or something like it that I can use?
Any help would be appreciated.
rebuilding the pipe to degree 1 will make it a square profile…
would this help?
Yes, that does work. It would still be nice to have script to do it at a push of a button.
Secondly, how would I adjust the the twisting of the square pipe if my pipe runs at a arc?
Currently the only way I know to control that is to orient my square profile and run a sweep.
This seems to be very time consuming when working out shapes for my metal tubing.
From looking at the script it would allow me to define the length of the sides of the square, select my path like it does the for the round pipe and be done. While not a programmer, it looks like it is what I am needing.
The script does calls for extrude curve along curve, but I think sweep1 command would work better for paths that are non planar.
I don’t know… I know what I want it to do, but unsure how to get there. Otherwise I doing it the old fashioned way.
I do have an old script for this, but it only runs on Windows Rhino (.rvb). I can try to convert it to Python so that it runs on Mac, but unfortunately no time until Thursday to start… --Mitch
Sounds great Mitch! Thank you so much. Can’t wait to try it out.
OK, here is a first go-round… I added a few bells and whistles from the old script, but there are also limitations:
- Works on multiple input curves
- Separate start/end side lengths (so you can make tapered sections)
- Entering 0 for the end side length will pipe to a point
- Cap or not
- Orientation of square section is still “random” based on Rhino’s evaluation of the input curves perpendicular frames (like normal Pipe command)
- Using different start/end values with kinked input curves (like polylines) will cause failures, so I ignore these cases. Kinked curves do work OK with uniform cross sections (same start/end sizes)
Let me know how it works for you. I also have a single size pipe script that is a bit simpler if need be.
MultisquarePipe2V.py (4.2 KB)
Works exactly how I wanted!
I have been using it the later half of the day without any issues.
Your script made quick work of some furniture I am working on today.
The limitations are you listed are very minor.
Maybe some features to consider if you are looking to improve on it.
- Length and width values. So rectangle tube can be achieved.
- Rounded corners similar to Command: _Rectangle command.
( I say this cause extruded metal tube never has sharp corners.)
- Wall thickness like the round pipe tool.
As is, the script is great. Thank you!
Yes, I expected this to be the next thing asked, and will have something soon - haven’t had time to work on it yet, but it’s not too hard. Just needs an extra command line input.
This is a good idea. Actually neither rhinoscriptsyntax nor RhinoCommon have a compact way to create a rounded rectangle, but a custom function can easily be written. I will include this in the next version. Again, one more command line input. Not sure how well this will work with kinked corners though.
This is somewhat more complicated, I will look into this at some later date.
OK, here is as far as I can go at this point. As soon as you start to introduce more variables, the coding gets more complex as there are special cases to handle and the scripts get more failure-prone. So here are
3 4 scripts: EDIT: below I added a fourth script to complete the collection…
Constant section square pipe with a single side length input and no rounding - for very simple operation.
Square pipe with options for corner rounding and different start/end sizes, including end to a point. Corner rads are constant throughout the sweep (no taper). Pipe to point will set corner rads automatically to 0 (sharp).
Constant section rectangular pipe with corner radius option. Edit: note that if you set the radius to exactly half of the smallest side length, it is programmed (in theory) to make a nice oval section as well.
Profile pipe. Uses an existing closed planar curve profile on WorldXY plane. Options:
-Choose base point - pick/type a point; simply pressing Enter will use the profile bounding box center
Base point will be mapped to path curves’ start and end
-Scale start/end profile
-Sweep to a point (put in 0 for second scale value)
MultisquarePipe.py (5.8 KB)
MultisquarePipe2VR.py (8.2 KB)
MultiRectPipeR.py (7.3 KB)
MultiProfilePipe.py (6.5 KB)
Thank you Mitch. These will be incredibly useful.
I have been trying them out this morning. Talk about a workflow saver…wow.
Thank you SO much!
Is there already a command to select the entirety of a piece of geometry’s outline edges? Idea being to take something like a block st of stairs, grab the “Frame” of the stairs, and have the frame auto-SquarePipeas a Macro.
Also a great set of tools by Mitch including some square and rectangle piping functions.
Nice, wil check that out. You know, I’m having trouble figuring out (even using online resourves) how to set up an Alias (and a macro button) to run that square pipe pyton script. Have tried using this, but it ends up giving me a “ResetEngine” command and doesn’t actually do antying:
UPDATE: While the question about making the macro from Python stands, I can probably figure it out now that I’ve imported Mitch’s Maque Tools (Dang, thank you, Mitch!) The square pipe and a slew of other stuff is on there. Will be diving in and going to school on those tools…
It is an incredible toolset…another thanks to Mitch!
I have found something that I’m not sure how to fix - The Multisquare Pipe maco on the “Piping” tab won’t work with closed curves - the separate python script link Mitch posted above DOES do this. The other iterations of the square pipe tool also fail with closed curves.
Anyone feel like taking this on? Can’t seems to figure out how the python language works in the macro button, and don’t have the time for that sort of learning curve at the moment
The scripts posted on the forum are newer than the ones in MicMacTools toolset. I have not had time recently to update the toolset files - and probably won’t for awhile yet, sorry. If the scripts have the same file names, you can simply replace the older ones in the toolset scripts folder with the newer ones posted on the forum…
If I’m keeping score properly, I don’t think there’s ever a need for you to say sorry, Mitch!
I will ask (because I’m finding it difficult to find the answer to) the Macro buttons in your Toolset have the actual scripting verbage IN the button, and don’t simply have an Alias or callout pointing to the script from File Explorer. I tried copy/pasting the new python script insidethe button macro, but doesn’t work.
Any suggestion as to how to create an updated Macro Button with the newer Python scripts?
Umm, no, for Mac, there are no buttons, no toolbars, only aliases. The scripts are all in one folder. Maybe you tried to use the Windows toolset instead? That won’t work on a Mac.