iLogic rule trigger on view placement in .IDW

iLogic rule trigger on view placement in .IDW

rzillich
Contributor Contributor
1,249 Views
6 Replies
Message 1 of 7

iLogic rule trigger on view placement in .IDW

rzillich
Contributor
Contributor

Hi, I've done some searching around, on this subject before I decided to actually register and ask and didnt turn anything up, I could just be blind, but I dont see anything. What im looking for, simply put, is an iLogic trigger (I believe that this is the only wasy to fire an iLogic rule) *or some other way* of firing an iLogic rule, upon placement of a drawing view in the drawing. Any help would be greatly appreciated! Thank Ya's!

0 Likes
1,250 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

Hi,

 

Is this each time you place a view? Or just the first time?  And what exactly is you ilogic code trying to accomplish?

0 Likes
Message 3 of 7

rzillich
Contributor
Contributor

It's always cooler,to me, to have it update whenever its possible to be updated, however, for this case all im trying to accomplish is having the drawing pull a property from the model to decide whether or not its a single part, an assembly, or a weldment, in an effort to have iLogic choose and place the parts list and detail callout.

0 Likes
Message 4 of 7

Anonymous
Not applicable

I can't see anything in the iLogic that would allow for an event to be fired for the placement of a drawing view.  However, you could try a macro call with your view selected.  Or if there's only the one part on a drawing that makes it easier.  If you have examples of what you want the final result to be and what you have to work with, I could take a look.

 

Here's what I understand.

 

    Given a view, determine if the view contains a part, assembly or weldment.

 

        If it's a part -> do something

        If it's an assembly -> do something

        If it's a weldment -> do something

 

Do you have to use iLogic?  You might have more flexibility with a macro.  I'm a Solidworks guy that's had to switch to Inventor so I'm not entirely familiar with the iLogic programming.

0 Likes
Message 5 of 7

MechMachineMan
Advisor
Advisor
Go To Manage > iLogic > Event Triggers.

If the Event Trigger you are searching for is not in there, it would require a separately programmed routine to accomplish any on event functions.

--------------------------------------
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
0 Likes
Message 6 of 7

Anonymous
Not applicable

Look at the DocumentEvents_OnChange event in the VBA editor.  This may allow you to do what you need, just be careful that you don't do major updates to your tables if you don't have to.  This event fires everytime you change something on the document.  If you are constantly creating tables each time you add a dimension, or move a view, Inventor may be slowed.

0 Likes
Message 7 of 7

Anonymous
Not applicable

Hi,

Do you need to run this rule only once for drawing? Only once for sheet? Does your sheet have only one model?

 

You can trigger this rule just before save drawing it will work only if you have DrawingView on sheet.

(You can also save the number of views in custom property and the rule can check if the DravingViews.count is the same.)

This should work for one model in one sheet.

 

 

Dim oSheet As Sheet
oSheet = ThisApplication.ActiveDocument.ActiveSheet

If oSheet.DrawingViews.count = 0 Then 
	'MessageBox.Show("No music", "I don't have the model...")
	Exit Sub
Else
	'MessageBox.Show("Let's dance", "I have the model!")
	oModel = oSheet.DrawingViews.Item(1).ReferencedFile.ReferencedDocument
End If

If oModel.DocumentType=kPartDocumentObject   Then 'kPartDocumentObject=12290, check 12291 & 12292
	'MessageBox.Show(oModel.DocumentType) 
	mat=oModel.ComponentDefinition.Material.Name
End If
If oModel.ComponentDefinition.Type=150995200 Then MessageBox.Show(oModel.ComponentDefinition.Type) 'for SheetmetalPart

 

0 Likes