Using Custom iProperties To Build The Part Number (In iProperties)

Using Custom iProperties To Build The Part Number (In iProperties)

Anonymous
Not applicable
990 Views
4 Replies
Message 1 of 5

Using Custom iProperties To Build The Part Number (In iProperties)

Anonymous
Not applicable

Hi Everyone,

 

First off, thanks for clicking on this post with the intention of trying to help.  you are all rockstars that have helped me out of more than enough jams in the past.  hopefully, someone can help me here as well.

 

I'm looking to create a Part Number Generator at the drawing level using iProperties and Parameters.  the end result would be having a part number that looks like this;

 

ABC-123-ABC123-123

 

My original idea was to create fill in 4 fields in a form and use the following code to fill in the Part Number field in iProperties.

 

Part Number field in iProperties

=<DWG_TYPE>-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SA_NUMBER>

 

iLogic Code Driving some specifics

iProperties.Value("Project", "Part Number") = "=AS-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

'Drawing Type Options

'Assemblies
If DRAWING_TYPE = "Assemblies" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=AS-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Assemblies" And SUB_ASSEMBLY >= 1 Then
iProperties.Value("Project", "Part Number") = "=AS-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Builds
ElseIf DRAWING_TYPE = "Builds" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=BD-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Builds" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=BD-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Design
ElseIf DRAWING_TYPE = "Design" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=DE-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Design" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=DE-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Electrical
ElseIf DRAWING_TYPE = "Electrical" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=EL-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Electrical" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=EL-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Fabrication
ElseIf DRAWING_TYPE = "Fabrication" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=FB-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Fabrication" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=FB-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Layout
ElseIf DRAWING_TYPE = "Layout" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=LA-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Layout" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=LA-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"

'Modules
ElseIf DRAWING_TYPE = "Modules" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=MOD-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Modules" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=MOD-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Parts
ElseIf DRAWING_TYPE = "Parts" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=PT-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Parts" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=PT-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Engineering Review
ElseIf DRAWING_TYPE = "Engineering Review" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=RE-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Engineering Review" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=RE-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"


'Set Up
ElseIf DRAWING_TYPE = "Set Up" And SUB_ASSEMBLY = 0 Then
iProperties.Value("Project", "Part Number") = "=SE-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

ElseIf DRAWING_TYPE = "Set Up" And SUB_ASSEMBLY <= 1 Then
iProperties.Value("Project", "Part Number") = "=SE-<PRODUCT_TYPE>-<PRODUCT_NUMBER>-<SUB_ASSEMBLY>"

End If



'Product Type

'Energy

If PRODUCT_OPTIONS = "Energy" Then
PRODUCT_TYPE = 100

ElseIf PRODUCT_OPTIONS = "Energy - Solar" Then
PRODUCT_TYPE = 101

ElseIf PRODUCT_OPTIONS = "Energy - Enclosures" Then
PRODUCT_TYPE = 102

ElseIf PRODUCT_OPTIONS = "Energy - Accessory" Then
PRODUCT_TYPE = 103

'Electrical

ElseIf PRODUCT_OPTIONS = "Electrical" Then
PRODUCT_TYPE = 200

ElseIf PRODUCT_OPTIONS = "Electrical - Skid" Then
PRODUCT_TYPE = 201

ElseIf PRODUCT_OPTIONS = "Electrical - Enclosures" Then
PRODUCT_TYPE = 202

ElseIf PRODUCT_OPTIONS = "Electrical - Accessory" Then
PRODUCT_TYPE = 203

ElseIf PRODUCT_OPTIONS = "Electrical - E-House" Then
PRODUCT_TYPE = 210

ElseIf PRODUCT_OPTIONS = "Electrical - MTS Builds" Then
PRODUCT_TYPE = 220


'Structural

ElseIf PRODUCT_OPTIONS = "Structural" Then
PRODUCT_TYPE = 300


'Specialty

ElseIf PRODUCT_OPTIONS = "Specialty" Then
PRODUCT_TYPE = 900

End If

 

However, as you may have guessed, the code above only works if the parameters are exportable and parameters at the drawing level are not.  I tried replacing;

 

iProperties.Value("Project", "Part Number") = "=AS-<PRODUCT_TYPE>-<PRODUCT_NUMBER>"

with;

iProperties.Value("Project", "Part Number") = "=AS-<PRODUCT_TYPE>-<iProperties.Value("Custom", "Product Name")>"

 

That only results in the following error;

Rule Compile Errors in P/N Generator, in Part16

Error on Line 1 : Character constant must contain exactly one character.

I think that I am close to figuring this out but, I've hit a wall.  Is there a way to create custom iProperites to preform the same function as the parameters?

 

 

Thanks,

Paul

0 Likes
Accepted solutions (1)
991 Views
4 Replies
Replies (4)
Message 2 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Below code may be helpful.

iProperties.Value("Project", "Part Number") = "=AS-<PRODUCT_TYPE>-" + iProperties.Value("Custom", "Product Name")

To reproduce the error, can you please provide non confidential drawing data?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you for your help.  That bit of code helped a lot.  However, I am not able to figure out how to run that code with multiple iproperty fields seperated by "-".

 

When I try

iProperties.Value("Project", "Part Number") = "=AS-" + iProperties.Value("Custom", "PRODUCT TYPE") + iProperties.Value("Custom", "PRODUCT NUMBER")

 

 I get AS-123ABC when I'm hoping for AS-123-ABC.

 

My attempts to solve this only run into errors like

Conversion from string "ABC" to type 'Double' is not valid.

or

Error on Line 1 : End of statement expected.

 

I am unable to send you an example of the drawing file as it is now.  However,  I think once I figure out the dash issue, I'll be ready to go.  If needed, I'll see about creating a drawing with all the code in it that lack company information.

 

Thanks again for your help.

0 Likes
Message 4 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous ,

 

Try below iLogic code to get desired part number as "AS-123-ABC".

 

iProperties.Value("Project", "Part Number") = "=AS-" + iProperties.Value("Custom", "PRODUCT TYPE").ToString + "-" + iProperties.Value("Custom", "PRODUCT NUMBER")

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 5

Anonymous
Not applicable

I see what I did wrong.  thank you very much for your help.

0 Likes