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 Titleblock Help

3 REPLIES 3
Reply
Message 1 of 4
LewisLusby
358 Views, 3 Replies

iLogic Titleblock Help

I wrote a rule which works really well. When opening a new idw template an iLogic form appears asking how many sheets and what size. You select and the sheets populate with individual titleblocks for each sheet (don't ask why!!)....that all works great! However, I'm trying to fix the code so it's possible to change the name of the sheets. "Sheets" is a user parameter btw

 

*************************************

For i=1 To Sheets

        If i>ThisDrawing.Document.Sheets.count Then   

        ThisDrawing.Document.Sheets.add  

        End If    

 

        ThisDrawing.Sheet("Sheet:" & CStr(i)).TitleBlock = "COMPANY NAME " & CStr(Sheet_Size) & " TB_" & CStr(i)

        ThisDrawing.Sheet("Sheet:" & CStr(i)).Border = "COMPANY NAME Border_" & CStr(Sheet_Size)  

        ThisDrawing.Sheet("Sheet:" & CStr(i)).ChangeSize ("" & CStr(Sheet_Size), Moveborderitems := True)

Next

 

If Parameter("Sheet_Size") = "A0" Then ActiveSheet.ChangeSize("A0", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A0_S" Then ActiveSheet.ChangeSize("A0", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A1" Then ActiveSheet.ChangeSize("A1", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A1_S" Then ActiveSheet.ChangeSize("A1", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A2" Then ActiveSheet.ChangeSize("A2", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A2_S" Then ActiveSheet.ChangeSize("A2", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A3" Then ActiveSheet.ChangeSize("A3", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A3_S" Then ActiveSheet.ChangeSize("A3", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A4" Then ActiveSheet.ChangeSize("A4", MoveBorderItems := True)

ElseIf Parameter("Sheet_Size") = "A4_S" Then ActiveSheet.ChangeSize("A4", MoveBorderItems := True)

 

Parameter.UpdateAfterChange = True

 

End If

 

InventorVb.DocumentUpdate()

 

ThisApplication.ActiveView.Fit

*******************************

 

If I change "Sheet" to Left(oSheet.Name,(Len(oSheet.Name) - 1)) in line 6,7 and 8 I would expect the rule to work however it does not. Can anyone help?

 

Thanks,

Lewis

3 REPLIES 3
Message 2 of 4
adam.nagy
in reply to: LewisLusby

Hi Lewis,

 

Where are you changing the name of the sheets?

Where does oSheet come from?

Maybe you could add some debugging: some message boxes with the info you are using or trying to assign.

 

When you say it does not work:
- is there an error?

- are the sheets created?

 

Cheers, 



Adam Nagy
Autodesk Platform Services
Message 3 of 4
LewisLusby
in reply to: LewisLusby

Hi Adam,

 

Thanks for your input.

 

I'd change the sheet name in the model browser in the idw.

 

Dim oSheet As Sheet

 

If I change the name of Sheet:1 for example then run the rule, the error is that "Sheet:1" does not exist....fairly obvious.

 

I've kinda given up on it, I'm no coding expert and cant seem to fix the loop.

 

Thanks,

Lewis

Message 4 of 4
xiaodong_liang
in reply to: LewisLusby

Hi Lewis,

 

So, if the code says "Sheet:1" does not exist, I'd suggest you dum their name by code to make sure what their name exactly are. e.g.

 

For i=1 To ThisDrawing.Document.Sheets.count

        MsgBox (ThisDrawing.Document.Sheets(i).Name) 

Next

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

Post to forums  

Autodesk Design & Make Report