Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Text Boxes in Border

4 REPLIES 4
Reply
Message 1 of 5
vex
Collaborator
616 Views, 4 Replies

Text Boxes in Border

vex
Collaborator
Collaborator

Does anyone, off hand, know the procedure/call to look through text boxes in the border of an IDW?

 

I have something similar to

 

[code]

Dim oBorder As Border

Dim oTextBox As TextBoxes

 

For Each oTextBox In oBorder.Definition.DrawingSketch.TextBoxes

...yadda... yadda... yadda...

Next

[/code]

 

I'm trying to hunt down the bolded & Red portion and I'm not getting much input on the Inventor Customization forum, so I decided to try my luck here.

0 Likes

Text Boxes in Border

Does anyone, off hand, know the procedure/call to look through text boxes in the border of an IDW?

 

I have something similar to

 

[code]

Dim oBorder As Border

Dim oTextBox As TextBoxes

 

For Each oTextBox In oBorder.Definition.DrawingSketch.TextBoxes

...yadda... yadda... yadda...

Next

[/code]

 

I'm trying to hunt down the bolded & Red portion and I'm not getting much input on the Inventor Customization forum, so I decided to try my luck here.

4 REPLIES 4
Message 2 of 5
SBix26
in reply to: vex

SBix26
Mentor
Mentor

Just browsing the 2016 API Help, it appears to me that you want oBorder.Definition.Sketch.Textboxes.  I have not tried this, but that's what I deduce from reading the help file.

Sam B

Inventor Professional 2015 SP2
Windows 7 Enterprise 64-bit, SP1
HP EliteBook 8770w; 8 GB RAM; Core™ i7-3720QM 2.60 GHz; Quadro K4000M

0 Likes

Just browsing the 2016 API Help, it appears to me that you want oBorder.Definition.Sketch.Textboxes.  I have not tried this, but that's what I deduce from reading the help file.

Sam B

Inventor Professional 2015 SP2
Windows 7 Enterprise 64-bit, SP1
HP EliteBook 8770w; 8 GB RAM; Core™ i7-3720QM 2.60 GHz; Quadro K4000M

Message 3 of 5
vex
Collaborator
in reply to: SBix26

vex
Collaborator
Collaborator

Thanks Sam for responding!

 

I actually originally had that particular line in the code previously but it failed to actually do much of anything. Well... it did something, but it wasn't what I wanted. It output the following error:

 

Error in rule: Autoincrementing Zone Number Rule, in document: Auto ANSI (in).idw

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.TextBoxes'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A907AE97-A78F-11D5-8DF8-0010B541CAA8}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

 

Which is leading me to believe I might need to run a for loop with oSketch.TextBoxes.Count rather than the For Each

 

I'll report back on how it works out. If however you know the solution to the listed error, I'm all ears.

0 Likes

Thanks Sam for responding!

 

I actually originally had that particular line in the code previously but it failed to actually do much of anything. Well... it did something, but it wasn't what I wanted. It output the following error:

 

Error in rule: Autoincrementing Zone Number Rule, in document: Auto ANSI (in).idw

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.TextBoxes'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A907AE97-A78F-11D5-8DF8-0010B541CAA8}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

 

Which is leading me to believe I might need to run a for loop with oSketch.TextBoxes.Count rather than the For Each

 

I'll report back on how it works out. If however you know the solution to the listed error, I'm all ears.

Message 4 of 5
vex
Collaborator
in reply to: vex

vex
Collaborator
Collaborator

I'm so close I can taste it.

 

My program now is able to read the TextBoxes in the border. But assigning new values/text to those text boxes is causing me issues. Using

 

oSketch.TextBoxes.Item(i).Text = CStr(Val(sSheetNum)*8-7)

Doesn't work, as I don't think Inventor likes me rummaging through the TextBoxes without first calling the editor via

 

Call oBDef.Edit(oSketch)

My fear is that by calling that edit screen that way I'm not editing an Instance but the Definition... Would it be possible to edit the Instance rather than the Definition; namely something along the lines of

 

oBorder.Instance.Edit(oSketch)

Or is that just causing me more grief than it's worth?

 

Edited to add:

 

It also appears that it's impossible to edit an instance of this border for some reason. Is this because there's an iLogic rule associated with it now?

Edit Instance.png

 

0 Likes

I'm so close I can taste it.

 

My program now is able to read the TextBoxes in the border. But assigning new values/text to those text boxes is causing me issues. Using

 

oSketch.TextBoxes.Item(i).Text = CStr(Val(sSheetNum)*8-7)

Doesn't work, as I don't think Inventor likes me rummaging through the TextBoxes without first calling the editor via

 

Call oBDef.Edit(oSketch)

My fear is that by calling that edit screen that way I'm not editing an Instance but the Definition... Would it be possible to edit the Instance rather than the Definition; namely something along the lines of

 

oBorder.Instance.Edit(oSketch)

Or is that just causing me more grief than it's worth?

 

Edited to add:

 

It also appears that it's impossible to edit an instance of this border for some reason. Is this because there's an iLogic rule associated with it now?

Edit Instance.png

 

Message 5 of 5
vex
Collaborator
in reply to: vex

vex
Collaborator
Collaborator

And it's as I feared:

 

Calling the edit command results in the program operating as it should (substituting the various <X> tags to the appropriate number), however it does this by editing the definition. Something I didn't pay attention to early on, but something I figure would be an easy fix, right? Well, according to the 2010 API pdf I had printed out ages ago (I'm using INV2015), it doesn't look like it's possible. For why the Sheet lists TitleBlock as an entity, the border is not listed as an object within that parent--indeed according to the 2010 API PDF it looks like BorderDefinition is the only available call that deals with the border.

0 Likes

And it's as I feared:

 

Calling the edit command results in the program operating as it should (substituting the various <X> tags to the appropriate number), however it does this by editing the definition. Something I didn't pay attention to early on, but something I figure would be an easy fix, right? Well, according to the 2010 API pdf I had printed out ages ago (I'm using INV2015), it doesn't look like it's possible. For why the Sheet lists TitleBlock as an entity, the border is not listed as an object within that parent--indeed according to the 2010 API PDF it looks like BorderDefinition is the only available call that deals with the border.

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

Post to forums  

Autodesk Design & Make Report