Selection Methods

Selection Methods

RoyWickrama_RWEI
Advisor Advisor
1,474 Views
4 Replies
Message 1 of 5

Selection Methods

RoyWickrama_RWEI
Advisor
Advisor

Many times I struggle for I am not good with selection methods. Currently, I need to know how to pick:

1. sketch(es) from a part document

2. part(s) from an assembly

3. dimension(s) from a drawing 

 

Could someone help me.

 

I am so enthusiastic of using iLogic because it helps creating production documents with improved accuracy and consistency, increased output etc.

Every time, I confront with so many tings to do. Fortunately, I find help from within the Inventor Forum: Thanks.

 

I need to know a lot more, I look forward to keep learning.

 

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

sajith_subramanian
Autodesk Support
Autodesk Support
Accepted solution

Hi @RoyWickrama_RWEI,

 

In iLogic, to pick different entities, the method would be the same, only you would need to change the Selection Filter.

 

For e.g., to pick a sketch entity, your code could be something like below:

 

  selectObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchObjectFilter, "Select sketch entity")
     

 

 

Similarly, to pick a part body you can modify the code as below:

 

 selectObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select part body")
	

 

And finally, to pick a dimension, you can use the below:

 

selectObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select drawing dimension")
	

 

There are a lot of similar filters that you can apply. In the Programming/API help file, search for "SelectionFilterEnum Enumerator". There is an entire list of filters you could play around with.

 

Hope this helps.

 

 

Regards,

Sajith


Sajith Subramanian
Autodesk Developer Network
Message 3 of 5

RoyWickrama_RWEI
Advisor
Advisor

I revised my rule with your help. It is fine. I can assign the selected dimension to a custom iProperty

SyntaxEditor Code Snippet: This is OK.

'iProperties.Value(oModelDoc, "Custom", oLWT_Array_IP) = oTxt_SizeOA

 

However, in case I still can't figure out how to assign the value of the selected dimension to some user parameter in the model with a code like shown below. It is not correct.

 

SyntaxEditor Code Snippet: Not OK.

iProperties.Value(oModelDoc, Parameter.Param("Length")) = oTxt_SizeOA

 

Attached here to are a sample part and it's drawing. Could you fix, Thanks a lot.

Note: This rule is not for a simple part, but for a huge assembly where we do not have Length, Width and Height information, Using model extents do not give correct data for any orientation of the model. But these information are available from within the drawing!

0 Likes
Message 4 of 5

MechMachineMan
Advisor
Advisor

Parameters are fundamentally different than iProperties, and thus, the calls are not related.

 

Parameter.Param("Length") = 

is the appropriate use of the parameter calls in order to assign a value to a parameter.

 

Please read the documentation regarding iLogic functions to understand more....

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2015...


--------------------------------------
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 5 of 5

RoyWickrama_RWEI
Advisor
Advisor
Accepted solution

With the link provided, I was able to figure out how to assign selected dimension to the user parameter in the model as below:

 

SyntaxEditor Code Snippet

Parameter(oModelDoc, oLWT_Array_IP) = oTxt_SizeOA

Thanks a lot. 

0 Likes