Inventor General Discussion

Inventor General Discussion

Reply
Distinguished Contributor
fakeru
Posts: 109
Registered: ‎03-07-2010
Message 11 of 20 (3,065 Views)

Re: iLogic Rule for idw drawing

08-16-2011 11:27 AM in reply to: Curtis_Waguespack

yes, this may help. I will try this tomorrow in the office.

thanks!

 

can you please recommend me the best, shortest, easiest way to learn how to make macros and rules. They are quite the same thing, no?

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
*Expert Elite*
Curtis_Waguespack
Posts: 3,000
Registered: ‎03-08-2006
Message 12 of 20 (3,062 Views)

Re: iLogic Rule for idw drawing

08-16-2011 12:02 PM in reply to: fakeru

HI fakeru,

If you're looking to start with iLogic (which I think is a good place to start) you can use these tutorials:

iLogic Basics

iLogic - Part Modeling

iLogic - Assemblies

 

And here are some examples:

http://inventortrenches.blogspot.com/search/label/Autodesk%20Inventor%20iLogic

 

If you're looking to work with VBA and Inventor's Application Programing Interface (API), here are a couple of links that should get you started:

 

... the paper below provides a brief overview of Inventor’s programming interface and illustrates this with examples using iProperties.

 

VBA & Inventor API Introduction (zip - 547Kb)
 

 

The following resource will help you get started with programming Inventor. It assumes familiarity with Autodesk Inventor and general programming concepts.

 
DevTV: Introduction to Inventor Programming

A self-paced video tutorial demonstrating how to get started developing with Autodesk Inventor. 
View online | Download

 

Check out the Self-Paced Guide “My First Plug-in” presented by the ADN Inventor Team

www.autodesk.com/myfirstinventorplugin



I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Employee
Yijiang.Cai
Posts: 359
Registered: ‎05-20-2008
Message 13 of 20 (3,044 Views)

Re: iLogic Rule for idw drawing

08-16-2011 08:14 PM in reply to: fakeru

There is one solution using API code to manage the drawing curves within every component in layer.

 

For example, there are three components in assebmly and create drawing view, this solution will create three layers in style editor for these three components respectively, and the drawing curves in each view projected from the component will be managed in the layer, and the layer's name is the same with the name of component.

 

Please copy the code in attached text, and paste it in VBA editor within one new drawing, then save it as one template. When the assembly is done, please create drawing views using this template. When the drawing views are done, please run the Macro and you will see the several layers created in style editor. So you can change the color of layer to change the color of drawing curves, which will keep the parts in all the views colored with the same color.

 

please see the attached image for more details.

 

Thanks,

River Cai

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Distinguished Contributor
fakeru
Posts: 109
Registered: ‎03-07-2010
Message 14 of 20 (3,016 Views)

Re: iLogic Rule for idw drawing

08-17-2011 09:34 AM in reply to: Yijiang.Cai

Unfortunately both scripts don't work properly... Not all the edges are colored (in case of first script) or included in the new layers (in case of the second script). I noticed these edges are tangent edges of the revolution features. In the attachment you can see the screenshot and you will understand. That is a part in the assembly. Any solution?

 

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
Employee
Yijiang.Cai
Posts: 359
Registered: ‎05-20-2008
Message 15 of 20 (2,995 Views)

Re: iLogic Rule for idw drawing

08-17-2011 08:21 PM in reply to: fakeru

I have seen the attached image, and got the issue you show. This Macro does work fine on R2011, and looks that you are using R2012 now. If yes, this is a known issue, and is not reproducible on R2012 SP1 internal build.

 

When SP1 is released, please have it packaged for a try.

 

Thanks,
River Cai

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Distinguished Contributor
fakeru
Posts: 109
Registered: ‎03-07-2010
Message 16 of 20 (2,981 Views)

Re: iLogic Rule for idw drawing

08-18-2011 01:10 PM in reply to: Yijiang.Cai

yes, I'm using R2012 and there is little chance that I will have SP1 update...

What a shame!:smileysad: 

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
Distinguished Contributor
fakeru
Posts: 109
Registered: ‎03-07-2010
Message 17 of 20 (2,908 Views)

Re: iLogic Rule for idw drawing

10-22-2011 03:03 AM in reply to: Yijiang.Cai

SP1 fixed the problem! :smileyvery-happy:

Autodesk Inventor 2015 Certified Professional
AIP 2014 SP2
Windows 7 x64
Dell Precision T7400 Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (4 CPU's), 32GB RAM, NVIDIA Quadro K4000 3072MB GDDR3
*Expert Elite*
cwhetten
Posts: 1,090
Registered: ‎09-03-2008
Message 18 of 20 (2,741 Views)

Re: iLogic Rule for idw drawing

02-07-2012 03:44 PM in reply to: Curtis_Waguespack

Brian Ekins' code uses the following line to set each collected edge to a colored layer:

 

      Call drawView.Parent.ChangeLayer(objColl, colorLayer

 

I have a problem with this method, because when I try to set the layer of a certain component, Inventor thinks about it for at least 20 minutes.  I don't know if it ever completes the process, because I haven't waited it out.  This is just too long.  If I just right-click the component (in the browser) and select Properties, I can change the color and linetype (see image) and it works immediately without bogging down.

 

So my question is, how do I write code to automatically change the properties just like I can do manually?  Is there a function I can call instead of ChangeLayer() that will do this, so I don't have to use layers?

*Expert Elite*
cwhetten
Posts: 1,090
Registered: ‎09-03-2008
Message 19 of 20 (2,730 Views)

Re: iLogic Rule for idw drawing

02-08-2012 03:51 PM in reply to: cwhetten

So, this is what I came up with:

 

Spoiler

Dim drawViews As DrawingView

For Each drawViews In ThisApplication.ActiveDocument.ActiveSheet.DrawingViews

      occ = drawViews.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences.ItemByName("InsertComponentNameHere")

 

Dim newColor As Color

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

 

Dim drawcurves As DrawingCurvesEnumerator

drawcurves = drawViews.DrawingCurves(occ)

 

Dim drawCurve As DrawingCurve

For Each drawCurve In drawcurves

      drawCurve.Color() = newColor

Next

 

 

Next

This works insofar as it gets around using layers, but I still have the problem of Inventor bogging down changing the color for each edge.  What I need to be able to do is write code that will do the same thing as when I right-click a component, choose Properties, and change the component color (rather than right-clicking a component, choosing "Select as edges" and then Properties > change color).  When done manually, this only takes a second.

 

Code gurus:  Can this be done?  How?

*Expert Elite*
cwhetten
Posts: 1,090
Registered: ‎09-03-2008
Message 20 of 20 (2,715 Views)

Re: iLogic Rule for idw drawing

02-09-2012 08:04 AM in reply to: cwhetten

Since this thread has been solved, I decided I really should start a new post here:

 

http://forums.autodesk.com/t5/Autodesk-Inventor/iLogic-component-edge-color-in-IDW-view/m-p/3325285/...

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.