iLogic code to display parameter in text box

iLogic code to display parameter in text box

Anonymous
Not applicable
2,654 Views
9 Replies
Message 1 of 10

iLogic code to display parameter in text box

Anonymous
Not applicable

Hello all,

 

Im new to iLogic code and was looking for a line of code that will take a Parameter and display as Text in a drawing.

 

Any help or advice will be greatly appreciated.  

0 Likes
2,655 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
nvm, figured it out
0 Likes
Message 3 of 10

MechMachineMan
Advisor
Advisor

Oops. Misread your post..

 

Here's an example of displaying a parameter in a MsgBox for anyone curious seeing as I wrote it anyways...

 

oParam = "d1138"
MsgBox(oParam & vbLf & vbLf & ThisApplication.ActiveDocument.ComponentDefinition.Parameters.Item(oParam).Expression)

 


--------------------------------------
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
Message 4 of 10

pschell
Contributor
Contributor

can you upload your solution for other people to view?

Message 5 of 10

Anonymous
Not applicable

How did you do it !!

0 Likes
Message 6 of 10

bozidarJES3S
Participant
Participant

Hello,

this thread is quite old, but I have the same problem and did not figured out how to add a user defined Parameter as a Text in a Drawing. I can import model Parameters into Drawing and show them, but my Form is in a Drawing, and I can't see Drawing Parametes in order to place them into Drawing.I need that in order to place it as a reminder next to Drawing. Please help. Thanks in advance!!

0 Likes
Message 7 of 10

WCrihfield
Mentor
Mentor

Hi @bozidarJES3S.  You may have to elaborate or explain the situation in more detail and use very specific proper terms so that we can fully understand your situation, and exactly what you are trying to do.

It sounds like you want to place a regular 'GeneralNote' (regular independent text note on a drawing sheet), that contains the name &/or value of a parameter.  In the images, is that rectangle representing an actual model file, or is it just a drawing sketch or draft view?  If it isn't representing an actual model file, and you haven't yet placed any other drawing view in the drawing that represent a model document, then you may not have access to the parameters within the model document yet.  Also in the one image of the Text editor dialog box, the word "Parameter" is shown in the box that usually shows the name of the document or component to pull parameters from.  Is "Parameter" the name of your 'Model' document, or the 'Drawing' document, (or both)? Then the next box to the right of that is usually where you need to choose which group of Parameters within that document you want to pull a parameter from (usually only contains ModelParameters or UserParameters to choose from).  I believe the phrase shown there is equivalent to User Parameters after translation.  Then I believe that pop-up message says "There is no parameter under this source." after translation.  Is it possible you are pointing to the model document in that image, and that parameter doesn't exist within the User Parameters of that model document?

 

It also sounds like you have a second problem.  You seem to be having trouble showing/working with this same parameter within an iLogic Form.  If you want to place a live reference to a text type parameter located within the drawings user parameters into a general text note on the drawing, you may need to either create it as a custom iProperty within the drawing instead, then use the iProperties tools in that Text Editor dialog to insert it, or maybe use an iLogic rule to create the text note with that reference in it.  The iLogic rule route will likely be fairly complicated though.

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 10

RNDinov8r
Collaborator
Collaborator

OK...after reading this, it sounds like what I am trying to do. I have a custom parameter (We'll Call it GlobalIxx) in my assembly. When I bring this assembly into my drawing template (made specifically for this assembly type) I want to display that custom parameter in a pre-placed text box so that any time I use that drawing template, when I place said assembly file, the Text Box will have an updated value for GlobalIxx from the assembly showing in the text box.

 

My initial method was to put the/a file with that cusom paramter in the drawing, the create the text box referencing said model parameter. Saving as an IDW template, then deleting the assemlby from the drawing and resaving. Naturally, upon using this new template, the custom parameters were no longer in the text block.

 

0 Likes
Message 9 of 10

WCrihfield
Mentor
Mentor

Hi@RNDinov8r.  That situation I can understand, and it can be fairly complicated to set up, because as you said, that link seems to disappear when the last drawing view of that model is deleted, because it looses the reference to the model document, and thus looses the connection to the parameter too.  I don't know if I've tried that specifically before within a template like that.  I have stuff in the title block that automatically updates to values in 'the model' when I place the first model view into it, but those are all 'standard' properties, not custom ones.  And I have sketch symbols which contain live references to custom iProperties in the model file, but I usually always insert those after I have placed model views on the drawing.  Could this note/text box be created as a sketch symbol, then inserted?  I'm not 100% sure it would make the needed difference, but it might.  When I go to edit one of my sketch symbol definitions (stored in separate drawing document as library), I can still see the <...> placeholders in there, containing the unquoted name of the user parameter or custom iProperty, and there are is no 'model document' present for them to point to, and no custom iProperties or user parameters in that drawing for them to point to.  So this seems like a definite possibility.

 

The alternative, similar to what I said in the previous post, would be to maybe include a unique placeholder within that note/text box that can be found/replaced by an iLogic rule.  Another idea is to create the needed parameter or property within the drawing document itself, with a default N/A type value, so that the note/text box has something persistent to point to point to.  Then copy the model value over to the drawing to overwrite its value when you place a model view.  Either way, some iLogic might need to be involved.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 10 of 10

RNDinov8r
Collaborator
Collaborator

So after reading your response, I tried this method:
 

  1. Create Custom iProperties in Assembly template
  2. Use iLogic to link variables in code to the Custom iProperties
  3. Drop assembly in a drawing file (the new template)
  4. Reference the new Custom iProperties in Title Block.
  5. Save the file.
  6. Delete the  model from the .idw template file.
  7. Resave the .idw template (in it's appropriate folder)

Once I did this I was able to start a new drawing using this new .idw template and put a newly created .iam and have those fileds display correctly on the drawing.

0 Likes