Translation VBA > iLogic

Translation VBA > iLogic

TONELLAL
Collaborator Collaborator
512 Views
4 Replies
Message 1 of 5

Translation VBA > iLogic

TONELLAL
Collaborator
Collaborator

Hello,

 

I have an iLogic rule with a sub :

 

Sub Modif_part(oPart As PartDocument)
...
End sub

 Is it possible to use on oPart syntax for parts, like

iProperties.PartColor="XXX"

or

p = Parameter.Param("YYY") ?

 

Or I have to use the VB syntax :

oPart.ActiveRenderStyle=oPart.RenderStyles.item("XXX")

or

p=oPart.ComponentDefinition.Parameters.UserParameters.item("G_T").Value

 

 

0 Likes
513 Views
4 Replies
Replies (4)
Message 2 of 5

MegaJerk
Collaborator
Collaborator
If you're using VBA, then you'll need to use the long form version

oPart.ActiveRenderStyle=oPart.RenderStyles.item("XXX")


I believe that the reason you can use those nifty little short hand versions in iLogic, are due to the delegates used when whoever happened to make iLogic (which was originally an outside plugin if I have my history correct) designed it.

You could of course create some classes that take the place of those easy to use keywords that you find in iLogic, but you'd need to make them.


If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
0 Likes
Message 3 of 5

TONELLAL
Collaborator
Collaborator

In fact I had initially a very simple rule like :

 

select case G_T

case 10

properties.partcolor="red"

case 20

properties.partcolor="green"

...

 

This rule was in the part. I'd prefer to have an external rule, so I have to scan all the assembly to apply the rule to all parts. I re-wrote the rule in VBA, it functions. I have modified the code to adapt it to iLogic (in fact only deleted all "SET"), it fucntions. I wondered I  could use the specific iLogic syntax only to simplify the code.

0 Likes
Message 4 of 5

Anonymous
Not applicable
Not sure if this applies, but in ilogic you can use the:
"Imports Inventor" statement and then use inventors objects as you like.
0 Likes
Message 5 of 5

TONELLAL
Collaborator
Collaborator

Ok, so it seems I can't simplify my iLogic code. So I'll use iLogic as if it was VBA...

0 Likes