×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro for Beam Profile Generation
5

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
 

-Kevin

RE: Macro for Beam Profile Generation

(OP)
Thanks Shaggy but I've already installed these and they don't match what our overseas steel provider has given.

 

-Kevin

RE: Macro for Beam Profile Generation

There is a macro out there that will save each configuration as its own part file.  That will get you part of the way there.  Do you know if you need to do a "save as" on the .sldprt file to change it to a .sldlfp?  Can you simply change the file extension in windows explorer?

-Dustin
Professional Engineer
Pretty good with SolidWorks

RE: Macro for Beam Profile Generation

(OP)
Awesome find! Thanks Shaggy.  The config ripper saves the files as .sldprt files.

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

Admittedly I am a hack when it comes to macros.

Try changing the below code:

CODE

NewName = Location & ConfigName & ".sldlfp" 'Create path

Its worth a shot

-Dustin
Professional Engineer
Pretty good with SolidWorks

RE: Macro for Beam Profile Generation

2
And do add the codes for selecting the sketch too before it is saved as library feature file.

CODE

boolstatus = Part.Extension.SelectByID2("Put the sketch name here", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
   
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

Add the following before you save the file:

CODE

swDoc.AddCustomInfo2 "Description", swCustomInfoText, ""
swDoc.CustomInfo("Description") = "Text visible in Cut list table"
this will change the setting in your original file but its not important, the current text will go into the file saved (I hope)

Without this property set you will get the same text for all Profiles in your Cut List Table.

RE: Macro for Beam Profile Generation

(OP)
You guys rock!

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

Have been trying to do similar. Create a weldment library from a part file with multiple configs.
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources