Linking a Text Parameter from part to assembly

Linking a Text Parameter from part to assembly

Anonymous
Not applicable
1,487 Views
6 Replies
Message 1 of 7

Linking a Text Parameter from part to assembly

Anonymous
Not applicable

In the past, if I wanted to pull a parameter from a part to an assembly I have used code similar to the following:

 

Parameter("Part", "Length") = Assembly_Length

 

Currently I'm trying to use the same code to pull through a text parameter, however I receive the following error:

"Object reference not set to an instance of an object."

 

 

Is there another bit of code that allows you to pull a text parameter through?

0 Likes
Accepted solutions (1)
1,488 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor
Please upload your code as txt file

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

Anonymous
Not applicable

The text file should be attached.

 

What I'm actually trying to do is pull text parameters from an assembly to a drawing. In the assembly I have a form where you can input basic dimensions and customer info, and I want to push the text info to a custom title block on the drawing. 

0 Likes
Message 4 of 7

MechMachineMan
Advisor
Advisor

To me, it looks like you have things backwards then.

 

Variable to assign a value to = VALUE to assign to the variable to the left

is how it works.

 

What your code is currently doing is PULLING from the active document ("Architect" on the right means that it's READING "Architect from the active document"), and what you want to do is PUSH. So if PUSHING values to the assembly, from each document is what you're after, then your code is correct, but if you are wanting to run from the assembly and pull from sub documents, you need to rethink your ordering. 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 5 of 7

Anonymous
Not applicable

The code I provided was from the drawing, so it was pulling the parameter from the assembly. This should be correct, unless I'm understanding your statement backwards. 

0 Likes
Message 6 of 7

MechMachineMan
Advisor
Advisor

Just like your single line of posted code in the original statement adds the parameter value to the PART specified before the equals sign, what the code you have attached in the text file is CURRENTLY trying to do is add parameters from the drawing into the assembly. This means you have all of your equations written backwards.

 

If the parameters on the right side of the CURRENT equations don't exist in the drawing, you would likely be getting errors for said reason.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 7 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try the below iLogic code to pull parameters from assembly and custom iProperties in drawing document. Need to run below iLogic in drawing document.

 

doc = ThisDrawing.ModelDocument

'Below code is to pull parameters from a document which is referenced in drawing document
ARCHITECT = Parameter(doc.DisplayName, "ARCHITECT") 
CUSTOMER_CONTACT = Parameter(doc.DisplayName, "CUSTOMER_CONTACT") 
DOOR_NO = Parameter(doc.DisplayName, "DOOR_NO")
DRAWING_NO = Parameter(doc.DisplayName, "DRAWING_NO")
ENTRANCE = Parameter(doc.DisplayName, "ENTRANCE") 
FINISH = Parameter(doc.DisplayName, "FINISH") 
JOB = Parameter(doc.DisplayName, "JOB") 
LOCATION = Parameter(doc.DisplayName, "LOCATION")
MAT_CEILING = Parameter(doc.DisplayName, "MAT_CEILING") 
MAT_ROOF = Parameter(doc.DisplayName, "MAT_ROOF") 
MAT_WALLS = Parameter(doc.DisplayName, "MAT_WALLS") 
MAT_WINGS = Parameter(doc.DisplayName, "MAT_WINGS")
MODEL = Parameter(doc.DisplayName, "MODEL") 
ORDER_NO = Parameter(doc.DisplayName, "ORDER_NO")

'Below code is to create custom propeties in drawing document
iProperties.Value("Custom", "ARCHITECT") = ARCHITECT
iProperties.Value("Custom", "CUSTOMER CONTACT") = CUSTOMER_CONTACT
iProperties.Value("Custom", "DOOR NO.") = DOOR_NO
iProperties.Value("Custom", "DRAWING NO.") = DRAWING_NO
iProperties.Value("Custom", "ENTRANCE") = ENTRANCE
iProperties.Value("Custom", "FINISH") = FINISH
iProperties.Value("Custom", "JOB") = JOB
iProperties.Value("Custom", "LOCATION") = LOCATION
iProperties.Value("Custom", "MAT'L CEILING") = MAT_CEILING
iProperties.Value("Custom", "MAT'L ROOF") = MAT_ROOF
iProperties.Value("Custom", "MAT'L WALLS") = MAT_WALLS
iProperties.Value("Custom", "MAT'L WINGS") = MAT_WINGS
iProperties.Value("Custom", "MODEL") = MODEL
iProperties.Value("Custom", "ORDER NO.") = ORDER_NO

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network