Sheet Name Ilogic from Various including Custom Parameters

Sheet Name Ilogic from Various including Custom Parameters

Anonymous
Not applicable
951 Views
2 Replies
Message 1 of 3

Sheet Name Ilogic from Various including Custom Parameters

Anonymous
Not applicable

Morning,

 

I'm a bit lacking in knowledge when it comes to coding. I want to generate the part number as the sheet name (so when I save out a autocad its the correct name) 

 

The drawing number is made up of  4 individual Custom parameters (blue), a couple of 'default' characters and the sheet number.

 

10000-MWL-C1A-25-DR-X-0001 

Custom                       Default    Sheet No 

 

1.PNG

This is the sheet name what I want to input to. 

2.PNG

So yeah if anybody as any ilogic code to do that, that would be great. I've attached the file. 

 

Secondary issue; In an ideal world the sheet number would read '0001, 0002, 0010', from what I can see on here that is not possible without we can create a custom parameter from it but that'll be a ballache probably! 

 

0 Likes
Accepted solutions (2)
952 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous 

 

Here is an example rule.

 

Just a reminder, programming questions of this type are better suited for the Inventor Customization forum :
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I've asked the moderators to move this post to that forum for you.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'get the active document
Dim oDoc As Document = ThisApplication.ActiveDocument
'get the active sheet
Dim oSheet As Sheet = oDoc.ActiveSheet
'get sheet name
oSheetName = oSheet.Name
'split the sheet name at the colon
'creating a string array
sSplit = Split(oSheetName, ":")
oName = sSplit(0) 'first item in string array
oSheetNumber = sSplit(1) 'second item in string array

'get the property values
oPPJ = iProperties.Value("Custom", "PPJ")
oCONTRACTOR = iProperties.Value("Custom", "CONTRACTOR")
oZONE = iProperties.Value("Custom", "ZONE")
oLEVEL = iProperties.Value("Custom", "LEVEL")

'set sheet name
oSheet.Name = oPPJ & "-" & _
			oCONTRACTOR & "-" & _
			oZONE & "-" & _
			oLEVEL & "-" & _
			"DR-X-000" & oSheetNumber
			

EESignature

Message 3 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous 

 

I was working on something else, and your question came to mind, and I realized I might have misunderstood your request... the previous rule writes the drawing number to the sheet name...

 

This rule gets the sheet number and formats it as 0001, 0002.... 0010, 0011, etc.... , then writes it to a custom iproperty which can then be used in the title block drawing number field.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'get the active document
Dim oDoc As Document = ThisApplication.ActiveDocument
'get the active sheet
Dim oSheet As Sheet = oDoc.ActiveSheet
'get sheet name
oSheetName = oSheet.Name
'split the sheet name at the colon
'creating a string array
sSplit = Split(oSheetName, ":")
oName = sSplit(0) 'first item in string array
Dim i As Integer
i = sSplit(1) 'second item in string array

If i < 10 Then
	oSheetNumber = "000" + CStr(i)
Else If i < 100 Then
	oSheetNumber = "00" + CStr(i)
Else
	oSheetNumber = CStr(i)
End If
'this is a custom iproperty to be used by the title block
iProperties.Value("Custom", "MY SHEET NUMBER") = oSheetNumber

EESignature