Macro for Beam Profile Generation
Macro for Beam Profile Generation
(OP)
thread559-179657: Using Excel Based Configurations In Assembly?
I did the best I could to search and find a macro to work with but a lot of the links/files are old and/or no longer work with SW.
I'm running SW 2010 3.1 and I've created a few .SLDLFP parts that consist only of a single sketch that represents a profile of extruded metal beams. The sketch is driven by an extensive design table (100 or so configurations).
The problem: I want to save these profiles so that I can choose them from my weldments profile list. The only way to do that right now is to pick a configuration, save-as SLDLFP, and rename the part (from "BeamProfile" to the profile name: "40 x 25 x 1.5".).
I'm sure this will be helpful for anyone that finds the in-built GB standards lacking, so maybe I can barter these files for some macro mastery help?
Thanks in advance from a Macro Newbie,
-KG
I did the best I could to search and find a macro to work with but a lot of the links/files are old and/or no longer work with SW.
I'm running SW 2010 3.1 and I've created a few .SLDLFP parts that consist only of a single sketch that represents a profile of extruded metal beams. The sketch is driven by an extensive design table (100 or so configurations).
The problem: I want to save these profiles so that I can choose them from my weldments profile list. The only way to do that right now is to pick a configuration, save-as SLDLFP, and rename the part (from "BeamProfile" to the profile name: "40 x 25 x 1.5".).
I'm sure this will be helpful for anyone that finds the in-built GB standards lacking, so maybe I can barter these files for some macro mastery help?
Thanks in advance from a Macro Newbie,
-KG
-Kevin






RE: Macro for Beam Profile Generation
http://gu
-Dustin
Professional Engineer
Pretty good with SolidWorks
RE: Macro for Beam Profile Generation
-Kevin
RE: Macro for Beam Profile Generation
-Dustin
Professional Engineer
Pretty good with SolidWorks
RE: Macro for Beam Profile Generation
http://sw
-Dustin
Professional Engineer
Pretty good with SolidWorks
RE: Macro for Beam Profile Generation
There's a lot of code inside that deletes the other configs that doesn't seem to work anymore, but that's OK.
I tried changing the file extension in windows but apparently solidworks adds a tag within the file when it's a "library feature" because it didn't work when I tried to open.
Now I just need to figure out how to add the code to make it save as a different file.
I think this might be where I need to add/modify the SaveAs prompt to saveas a SLDLFP type.
/code: (I don't know how to make this register as code, any formatting tips?)
For i = 0 To UBound(ConfigNamesArray)
ConfigName = ConfigNamesArray(i) 'Assign next config name to ConfigName variable
Part.ShowConfiguration2 (ConfigName) 'Set next config as current
NewName = Location & ConfigName & ".sldprt" 'Create path
Part.SaveAsSilent NewName, True 'Save as current config name
Next i
-Kevin
RE: Macro for Beam Profile Generation
ht
RE: Macro for Beam Profile Generation
Try changing the below code:
CODE
Its worth a shot
-Dustin
Professional Engineer
Pretty good with SolidWorks
RE: Macro for Beam Profile Generation
CODE
NewName = Location & ConfigName & ".SLDLFP" 'Create path
Deepak Gupta
SW 2010 SP4.0 & 2011 SP1.0
DriveWorks Pro 7 SP5
Boxer's SolidWorks™ Blog
RE: Macro for Beam Profile Generation
CODE
swDoc.CustomInfo("Description") = "Text visible in Cut list table"
Without this property set you will get the same text for all Profiles in your Cut List Table.
RE: Macro for Beam Profile Generation
I'll have a chance monday to try these out and see how it goes.
I'll upload the final script and profiles once I get it all going!
-Kevin
RE: Macro for Beam Profile Generation
I am no programmer and after trial and error (many of them) I put together this solution that works for me on SW2011 SP4. X64Bit.
First download a copy of ConfigRipper...
1) Open weldment part file that has multiple configs.
This file should have only a sketch, no solid features.
2) Saveas Library file *.sldlfp
3) Select sketch (note name) Right Mouse Click, Select "Add to Library"
4)Save
5)Edit ConfigRipper
5.1) Change all "sldprt" to "sldlfp"
5.2) Rem (')'If Part.GetType <> swDocPART...... down to....
'Else
' GoTo Rip
'End If
(This is because we are now opening a sldlfp file not a part file)
5.3) add the following from Deepak after NewName+Location....
boolstatus = Part.Extension.SelectByID2("Pipe", "SKETCH", 0, 0, 0, False, 0, Nothing, 0) ' Thanks to Deepak Gupta
and just before... Part.SaveAsSilent NewName,....
5.4) Replace the sketch name "Pipe" with the sketch name in your file
6) Save macro
7) Open Library file
8) selct skectch (just in case)
9) Run new macro.
I Suggest you try it with just 3 or 4 configs first.
Have the file in its own empty directory.
When done copy new file to yur weldment direct in new folder and test.
I ran this on a file with 275 pipe sizes, too approx 1 hour.
Thanks to all for posting and sharing the bits and pieces, hopefully this helps speed up the process for the next person.