API help, automatic generation of 1/8" pipe

Im just starting to get into writing API, so ANY help would be
appreciated :).
I am trying to create a macro that automatically generates different
sizes/schedules of pipe. What statement can I use to create the
sketch profile, Fully defined, and extrude to desired lenght.
Below is the code I currently have. It doesnt fully define the
sketch, since the center of the pipe sketch isnt create on the origin
of the part, plus it doesnt define the OD. The OD also doesnt come
out correctly, it should be .405.
If ComboBox1 = ".125 (.405 OD)" Then

Dim Radius As Double
Dim Depth As Double
Radius = 0.405 / 2 * 0.0254
Depth = 2 *
0.0254
swModel.CreateCircleByRadius2 0.05 * 0.0254 + Radius, 0.05 *
0.0254 + Radius, 0, Radius
swModel.SketchOffset2 0.068 * 0.0254, 0, 1
swModel.ViewZoomtofit2
Set swFeatMgr = swModel.FeatureManager
swFeatMgr.FeatureExtrusion True, False, True, 0, 0, Depth, 0,
False, False, False, False, 0, 0, 0, 0, 0, 0, False, False, False
swModel.ViewZoomtofit2
End If
Reply to
SW Monkey
Loading thread data ...
I actually created a macro for exactly that a few months ago. E-mail me and I will send you th full thing and you can make changes to it as you desire or just use it as a reference. After you hit the button a form comes up with drop downs for Schedule and size and it shows the id and od that it is going to create then you type in the length in inches and hit Make tube. I created it quickly and with the schedules and sizes we use and I could find info on, So you may have to add some to fit your needs.
Regards,
Corey
Reply to
Corey Scheich
Oooo, oooo, me too, please - email on the way.
I can see this being useful for things other than just pipe that have a similar structure.
WT
Reply to
Wayne Tiffany
I have one for Square and rectangular tubing also. I am adding some notes to it I have been a bad programmer.
Corey
Reply to
Corey Scheich
At my company, we auto generate almost all of our piping parts (pipe, flanges, heads, etc.). While having a program to draw the part is nice, it can become cumbersome to write and a little slow for more complicated parts (like flanges). What we do is we have a part template for each kind of part (e.g. there's one for each style of flange that we use), and the parts are constructed in SolidWorks using linked dimensions and equations where possible to minimize the actual number of dimensions that are changed. Then when you tell the program you want a 4" standard pipe, or a 3" 300# raised face flange, it opens the correct part template file, changes the needed dimensions (which is easy with ModelDoc2->Parameter and the dimension name), and saves the part with the appropriate name. The other nice thing about this is that all the faces are named consistently for mating, which makes swapping out parts really easy.
Jonathan Anderson snipped-for-privacy@jwoperating.com To email me, include my first name in the email. And my last day here for a while is Friday, but if you really want to ask me a question after then email me at jlanderson at gmx dot net.
Reply to
Jonathan Anderson
Funny I had actually thought about adding this but I didn't feel like doing it yesterday, maybe in the future.
Reply to
Corey Scheich

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.