Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic for part numbers change on save

1 REPLY 1
Reply
Message 1 of 2
qsroos
270 Views, 1 Reply

ilogic for part numbers change on save

Hi 

 

I am hoping someone could be able to help with the following

 

We are building parametric adjustable model running of i logic rules and parameter equations wich work great . 

The problem that i am having is that parts in the model already have all their part  numbers in place , now when i edit something for instance the lenght some of the parts need to change to update the model and some will stay the same as it is now a similar assembly (maybe just longer).

 

Now the parts that have changed still have there original part numbers wich are then incorrect as the longer part is now a new part and needs a new number , after updating the model I however have no idea wich parts changed as the models are quite complex .

 

My question then

 

Is there a way (Maybe a rule of some sort ) that will allow inventor to on save tell me wich parts changed and allow me to enter new part numbers in say a dialog box.

 

( No we do not run vault or any real MRP program to manage this for us )

 

Any help will be greatly appreciated . I have attached a simple sample parametric model to play with ...  

1 REPLY 1
Message 2 of 2
humbertogo
in reply to: qsroos

use OnSaveDocument Event

 

 

ApplicationEvents.OnSaveDocument( DocumentObject As Document, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, HandlingCode As HandlingCodeEnum )

BeforeOrAfter Input indicating if the notification is being sent before the document is saved (kBefore), after a change is made (kAfter), or when a change has been aborted (kAbort).

 

 

'Firstly you need a class that sinks the events, for example:

Option Explicit

Private WithEvents oApplicationEvents As ApplicationEvents

Private Sub Class_Initialize()
  Set oApplicationEvents = ThisApplication.ApplicationEvents
End Sub

Private Sub Class_Terminate()
  Set oApplicationEvents = Nothing
End Sub

Private Sub oApplicationEvents_OnSaveDocument(ByVal DocumentObject As Document, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
  If (BeforeOrAfter = kBefore) Then
    MsgBox ("about to save " & DocumentObject.FullFileName)
  Else

  MsgBox (DocumentObject.FullFileName & " has been saved")
  End If
End Sub

'Then you need to create an instance of this class so that 
'the event is reacted to e.g.


Option Explicit

Dim oEventHandler As MyEventHandler

Sub listenToEvents()
  Set oEventHandler = New MyEventHandler
End Sub

Sub stopListening()
  Set oEventHandler = Nothing
End Sub

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report