Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic for file naming and sheet naming

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
sjsmith1247
713 Views, 4 Replies

iLogic for file naming and sheet naming

Hello Everyone,

 

    I'm trying to create an iLogic rule that does several things.  Perhaps this needs to be done in several rules, but I'm not sure.  I've scoured the customization forum, but I'm not that good at writing the advanced code that it would appear this requires.

 

So here is what I'm trying to accomplish.

1: On multisheet IDW's I'm trying to get the sheet name to read "Sht (sheet-number)-(numberofsheets)"

2: Next, when I export these idw's to ACAD I'm trying to get it to come out as "DwgNo_sht(sheet-number)-(numberofsheets)".  Currently when we export it would come out like 64009-4_Sheet_1, ..._Sheet_2.  I'm trying to make it so it comes out as 64009-4_Sht1-3, 64009-4_Sht2-3

 

I've tried several of the snippets I've found on here and then tried to customize, but I can't seam to get any to do what I'm looking for.  I use the <Stock Number> as the drawing number and the partnumber represents our actual part number.

 

I have the title block to read for example (DA_Sht1-3).  The problem lies into trying to export them that I have to go back and rename the files.

 

If anyone else has a better idea I'd love to hear how they manage multisheet drawings.

If anyone can help me it would be greatly appreciated.

 

IV 2013 SP4
4 REPLIES 4
Message 2 of 5
bretrick30
in reply to: sjsmith1247

The code below will rename the sheets in the .idw to the format you are looking for.  It should also name your files correctly when you export as a dwg.  It pulls the sheet names during the export.

 

Dim oSheet As Sheet

Dim oSheets As Sheets

oSheets = ThisDoc.Document.Sheets

 

Dim count As Integer

count = 0

 

For Each oSheet In oSheets

count += 1

 

oSheet.Name = "Sht " & count & "-" & oSheets.Count

 

Next

Message 3 of 5
timothy_berg
in reply to: bretrick30

Does the code work for the Inventor .dwg format also?

Message 4 of 5

I am new to this rule and ilogic creation so please forgive my ignorance's. This code seems to be very close to what I need but I'm unsure of how to convert it for my needs. I want the generic sheets 1-9 to have two digits so they appear as 01-09. Any help with this is greatly appreciated.

 

Thanks

Message 5 of 5

As far as I know you have to pad the numbers yourself as there is no good vb code.  But you should be able to try this.

 

Dim oSheet As Sheet

Dim oSheets As Sheets

oSheets = ThisDoc.Document.Sheets

 

Dim count As Integer

count = 0

 

For Each oSheet In oSheets

count += 1

 

oSheet.Name = "Sht " & Right("0" & count, 2) & "-" & Right( "0" & oSheets.Count, 2)

 

Next

IV 2013 SP4

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report