iLogic component edge color in IDW view

iLogic component edge color in IDW view

cwhetten
Advisor Advisor
4,161 Views
10 Replies
Message 1 of 11

iLogic component edge color in IDW view

cwhetten
Advisor
Advisor

Is there code for changing the color (or other properties) of the visible edges of a component in a drawing view, the same way I can do it manually by right-clicking a component and choosing Properties?

 

I wrote this rule to change the color of each individual drawing curve:

 

Edit: Ignore the "<!".  It's the only way I could get the iLogic code to successfully post in the message Smiley Mad

 

Spoiler
<!Dim drawViews AsDrawingView

For Each drawViews In ThisApplication.ActiveDocument.ActiveSheet.DrawingViews

occ3 = drawViews.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences.ItemByName("GF_Plenum:1")

 

Dim newColor3 As Color

newColor3 = ThisApplication.TransientObjects.CreateColor(0,255,255)

 

Dim drawcurves3 As DrawingCurvesEnumerator

drawcurves3 = drawViews.DrawingCurves(occ3)

 

Dim drawCurve3 As DrawingCurve

For Each drawCurve3 In drawcurves3

      drawCurve3.Color() = newColor3

Next

 

Next

 

However, the problem with this rule is that it selects each of the drawing curves and individually sets the color property.  For a drawing of a small assembly, this would work fine.  But I have a medium-to-large assembly, and when the rule gets to a certain view, it takes FOREVER to run through this rule.  If I manually set the component properties (rather than the edge properties), it only takes a fraction of a second.

 

How do I write code to do what I can manually do?  Just to be clear, there are a few ways to set the properties of a component in a drawing view.  One is to select each of the edges individually and apply the properties.  Another is to select the component in the browser, right-click, choose "Select as Edges", and then apply properties.  And yet another is to select the component in the browser, right-click and choose Properties (see attached image).  I would like to do this last one with code.

 

Any iLogic or VBA gurus out there know how to do this?

0 Likes
4,162 Views
10 Replies
Replies (10)
Message 2 of 11

fakeru
Advocate
Advocate

I will subscribe to this thread as I face the same problem.

I have used the rule that changes the parts colors by assigning each curve to a layer, but it turned out that this not a good way to color the parts in idw. After reopening those drawings, many curves were black again (default color).

I was also thinking about a rule that will color a part through its properties, like I do it manually. Hope somebody can do it. I'm really struggling with rules and everything related to programming 😞

 

Regards

Alexandru 

Autodesk Inventor 2015 Certified Professional
0 Likes
Message 3 of 11

PACDrafting
Collaborator
Collaborator

I have a feeling this is not available in the API.

0 Likes
Message 4 of 11

DeerSpotter
Collaborator
Collaborator

I would like to know, if in 2014 this problem can be solved finally. 

Did anybody figure out how to do this?

Here is the original Thread: http://forums.autodesk.com/t5/Inventor-General/iLogic-Rule-for-idw-drawing/td-p/3124520/page/2

 

Another thread: http://forums.autodesk.com/t5/Inventor-Customization/part-colour-be-line-colour-in-idw/td-p/2888796

 

Image and video hosting by TinyPic
..........................................................................................................................
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
..........................................................................................................................


See My LinkedIn Profile
0 Likes
Message 5 of 11

DeerSpotter
Collaborator
Collaborator

line colors.PNG

 

is there any code that would be able to do this?

Image and video hosting by TinyPic
..........................................................................................................................
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
..........................................................................................................................


See My LinkedIn Profile
0 Likes
Message 6 of 11

Kyle.Arnold
Enthusiast
Enthusiast

Restarting up an old thread. Anyone with any point of view on this please chime in. I'm facing similar issues... Anybody at all that can say anything either supporting or opposing the OP's thoughts.

 

 

"Hello? Is there anybody in there? Just nod if you can hear me. Is there anyone at home?"

Thanks!

Kyle Arnold
Inventor Certified Professional

"Try not. Do or do not, there is no try." -Yoda
Message 7 of 11

sebastien008
Contributor
Contributor

I all,

 

I'm also looking at something like this.

I would like to know if there is any other way than the traditional :

 

https://knowledge.autodesk.com/support/autocad-mechanical/getting-started/caas/CloudHelp/cloudhelp/2...

 

 

This way the user have to select each coponenet one buy one

 

Why don't inventor go and capture selected apparence of the model and apply it on the edges ??

 

Anyone with a simpler solution or  any way to do it with Ilogic

 

1 check each item component in a dwg

2 check the componenet apperance parameter = A

3 select as edges

4 apply layout according to A

this is the logic I would like to creat... simple to right not simple for find the terme in Ilogic language....

 

I working on this for more than a year, and I will not give up but a bit of help will be really appreciate.

 

thanks guys

Message 8 of 11

mcgyvr
Consultant
Consultant

@sebastien008

http://modthemachine.typepad.com/my_weblog/2010/10/changing-drawing-curves-to-match-assembly-color.h...

Not ilogic but I assume it can be converted to an ilogic rule vs vba

 

It will do this..

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 9 of 11

DeerSpotter
Collaborator
Collaborator

ill see if i can stay late one of these days to figure it out. But no promises. It seems easy now with 2016.

Image and video hosting by TinyPic
..........................................................................................................................
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
..........................................................................................................................


See My LinkedIn Profile
0 Likes
Message 10 of 11

sebastien008
Contributor
Contributor

Hi all,

 

please find attached my own script based on so many online help.

hope this can help you guys

 

thanks to MOD THE MACHINE THOUGH,

 

see you.

Message 11 of 11

BRABO_1
Explorer
Explorer

Hello,

I have found this old thread, but for me it's still an actual problem. The Code from Sebastien / Mod the Machine works great. However the problem is, it seems to change alle the lines and put them in the same layer and therefore they lose there linetypes(continuous and hidden lines) is it possible to keep the linetype and change the colour?

Maybe there are 2 runs, 1 for visible and 1 for hidden lines required?

Anyone knows a solution? Help is very appreciated!

Thank you in Advance!

0 Likes