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: 

Leading Zeros for Sheet Number in Sheet Properties

15 REPLIES 15
Reply
Message 1 of 16
Anonymous
2039 Views, 15 Replies

Leading Zeros for Sheet Number in Sheet Properties

Hello All,

 

Hope this is the correct location to post this.

 

I have what seems to be an easy question but the answer is eluding me.

 

I have 2 drawing numbers in a document (.idw) a company drawing number & a client drawing number.

Both need to reference the sheet number within the drawing number.

The problem I'm having is our company number needs to read XXX.1 (1 being the sheet number) but the client number needs to read XXX.001 (001 being the sheet number)

 

I haven't been able to find where I can change the format of this property either in inventor properties or iLogic.

Also is it possible to have to different formats of the same referenced property within the same document (.idw)?

 

Any help would be much appreciated.

Please feel free to ask questions if I haven't provided enough information

 

Kind Regards

 

Tim

15 REPLIES 15
Message 2 of 16
Anonymous
in reply to: Anonymous

In ilogic you do this:

 

SyntaxEditor Code Snippet

Dim oString As String = 0
Dim oDouble As Double = 1

oString = Microsoft.VisualBasic.Strings.Format(oDouble,"00#")

MsgBox(oString)

 

So the message box will return 001

 

I hope that helps

Message 3 of 16
BrandonBG
in reply to: Anonymous

That's how you create leading zeroes, but it doesn't access the sheet number. I may be missing something, but I've found the sheet number to be hard to access.

 

Over in the drawing browser tree, the "Title:1" and "Sheet:2" are the Sheet.Names, but I can't find the iLogic or API magic that gets just the number of the sheet.

 

 

 

>>>>more code before<<<<

Dim oParentViewSheetName As String oParentViewSheetName = oParentViewSheet.Name Dim oParentViewSheetIndex As String Dim oColonIndex As Integer oColonIndex = oParentViewSheetName.IndexOf(":") Dim oParentViewSheetNameLength As Integer oParentViewSheetNameLength = Len(oParentViewSheetName) oParentViewSheetIndex = Right(oParentViewSheetName, oParentViewSheetNameLength-oColonIndex-1)

 BrandonBG

Inventor 2015

Message 4 of 16
Anonymous
in reply to: BrandonBG

I don't think he is trying to actually change the format of the sheet number, just generate a part number that includes the sheet number. 

Message 5 of 16
BrandonBG
in reply to: Anonymous

You are correct.

 

My code is not the solution, but it shows how I grab the sheet number. He does need to access the sheet number to rename the part.

 

BrandonBG
Inventor 2015

Message 6 of 16
Anonymous
in reply to: Anonymous

Thanks for your response guys,

 

My apologies for not explaining thourougly.

In short DRLTKSE I am trying to format the sheet number.

It is just that sheet number/property is referenced in 2 locations/drawing numbers a company & a client (please see attached)

 

Client Document Number.pngCompany Document Number.png

 

They both reference the inventor Sheet Property - Sheet Number & the format is currently to a sinlge digit (eg .1 , .10) which is required for our company document. Im trying to customize the Client document sheet number to 3 digits (eg .001 , .010) which is required by our client

 

Sheet Number Reference.png

 

If managed to get the active sheet number using the following code if it helps, but I haven't been able to format it

 

Active Sheet Number Code.jpg

 

Also I then only need the formatted number to update the client document number only, which is contained within a sketch symbol

 

Hope this explains it a bit better & many thanks in advance for your help.

If you have any further questions please feel free to ask

 

Kind Regards

 

Tim

 

 

Message 7 of 16
Anonymous
in reply to: Anonymous

Just thought I would add that both the Company & the Client document number are in the same drawing (.idw)

 

Tim

Message 8 of 16
BrandonBG
in reply to: Anonymous

We just had a discussion here about using a different format for Sheet Numbers that is more in line with architectural drawings (A1.1 A1.2 etc.).

 

I think the solution is to create a parameter that acts as the modified sheet number. Then, pull that into the part name. I don't think the Sheet Number can be modified itself.

 

BrandonBG

Inventor 2015

Message 9 of 16
Anonymous
in reply to: BrandonBG

I agree with BrandonBG, you need to create a custom property derived from the sheet number and then format it the way you want. 

Message 10 of 16
Anonymous
in reply to: Anonymous

Actually it's a bit more complicated than that. If you make a custom iproperty it would update the sketched symbol on every sheet to show the number of the current sheet. 

 

You could just make a prefix of 00<sheet Number> but then sheet 10 would be XXXX.0010 and I imagine you want XXXX.010

Message 11 of 16
Anonymous
in reply to: Anonymous

Yeah I had that same idea Brandon

 

I used the following code to get the sheet number of the active sheet & set my custom parameter

 

oDoc = ThisDoc.Document
SheetNumber  = Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1)
MessageBox.Show(SheetNumber, oDoc.ActiveSheet.Name)

Parameter("Sheet_Number") = SheetNumber

 

 

MessageBox.Show(CStr(Format(Sheet_Number, "000")))

 

Argument not specified for parameter 'format' of 'Public Shared Function Format(enumType As System.Type, value As Object, format As String) As String'.

 

I cant seem to figure out how to format the custom parameter.

Also how would I get the code to search through all sheets for relevant sketch symbol update the custom parameter then update it in each sheet?

Scratching my head as well to what would be code triggers for if I add or delete sheets or reorder them.

 

Any idea's?

 

Tim

 

Message 12 of 16
Anonymous
in reply to: Anonymous

You should format the sheet number before setting it to the parameter as in the code I posted earlier

 

Message 13 of 16
mrattray
in reply to: Anonymous

I would use prompted entry for this instead of trying to use a parameter or property as these are drawing wide. Prompted entry is the easiest way I've found to have different sheets say different things.
For each loop through all sheets, read sheet number, format, find appropriate sketched symbol, find the prompted entry (requires another for each), set the entry to the formatted drawing/sheet number.
Mike (not Matt) Rattray

Message 14 of 16
pmaxwellNKJEX
in reply to: Anonymous

Digging up an old one, but was a working solution discovered?

I need to do a similar thing but also need to set a starting number

Message 15 of 16
WCrihfield
in reply to: pmaxwellNKJEX

Just a quick FYI:  In Inventor 2024, you can now drop the 'Sheet Name' directly into the 'Format Text' dialog, from the drop-down options.  That was one of the new abilities.

Text Enhancements (What's New in 2024) 

Beyond that, the Sheet Number property that you can drop into the Format Text dialog, does not seem to be mentioned in the official FormattedText online help page, so using a PromptedEntry, as the previous poster mentioned is still likely among the best options available today, even though they may seem to be a bit of a pain to deal with at times.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report