Using iLogic to generate dimenions

Using iLogic to generate dimenions

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

Using iLogic to generate dimenions

Anonymous
Not applicable

Hi all,

 

Recently I have came up with an ilogic code to generate dimensions for an assembly using the 'Capture Current State' method. However, this assembly of mine sometimes has suppressed parts depending on situation.

 

Problem is that I am only able to generate the dimensions when all parts are unsuppressed. Whenever I have a part suppressed, the rule cannot complete running and there will be error saying "GetIntent(xxxxx.ipt) was not found". I know that this error occurs due to the suppressed part and right now I only temporarily bypass this error by commenting away the "GetIntent" and respective "linDim" lines.

 

Is there a way to bypass this error and be able to run the rule without commenting away those lines and still be able generate dimensions for the rest of the lines ?  

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

JelteDeJong
Mentor
Mentor
Accepted solution

You could try to enclose the line that is failing in a try catch block.

Try
   ' add the lines of code for creating the dimension (that could fail) here
Catch ex As Exception
   ' MsgBox("You could add a wanig here that the dimension is not placed")
End Try

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 7

Charlies_3D_T
Advocate
Advocate

@Anonymous 

 

Hello, 

 

Can you post your code for dimensions please? 

0 Likes
Message 4 of 7

Anonymous
Not applicable

Hi,

Thanks for the help! I am able to bypass the error by including the Try-Catch statement and re-arranging some of the code.

0 Likes
Message 5 of 7

_dscholtes_
Advocate
Advocate

Wouldn't it be better to check first if the component you want to dimension is suppressed? (And keep the try-catch code for the really unexpected errors)

0 Likes
Message 6 of 7

Anonymous
Not applicable

Hi,

 

The problem was with dimensions not being able to be generated as I was unable to run the GetIntent line from the suppressed component.

 

Let's say I have 10 components in total and I suppressed the 9th and 10th components for my assembly, then I am unable to run the 9th component GetIntent line which causes the code to stop running.

 

I am not sure if this is the best way, but I managed to bypass this issue by rearranging it like this:

.

.

.

GetIntent (Component8)

linDim (Component8)

 

GetIntent (Component9) 'Gets stuck here but i was able to at least get linDim1~8

linDim (Component9)

 

GetIntent (Component10)

linDim (Component10)

 

Before this it was this way:

.

.

.

GetIntent (Component8)

GetIntent (Component9) 'Gets stuck here without any linDim

GetIntent (Component10)

.

.

.

linDim (Component8)

linDim (Component9)

linDim (Component10)

0 Likes
Message 7 of 7

_dscholtes_
Advocate
Advocate

It's a matter of preference. If I knew that my code doesn't work because of a suppressed component, I would check this before generating the dimension. This way I can tell my program specifically what to do when this happens.

So I would probably add something like this (not tested, but for a general idea):

If Component8.Suppressed = False
    GetIntent (Component8)
    linDim (Component8)
End If

or

If Not GetIntent (Component8) Is Nothing Then linDim (Component8)

 

0 Likes