cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Event Trigger Before Print

iLogic Event Trigger Before Print

It would be nice to have an event trigger for before a drawing prints. This would be helpful for adding a printed date to a drawing. I've seen a few threads here and there about adding a printed date, but the only work arounds aren't perfect. One example is manually using an iLogic or VBA script to add the date then print it after that manually or with the script, the issue with that is some people won't use the script and I can't force them to.

With a before print event trigger it would be possible to modify the drawing automatically each time before it is printed.

9 Comments
pdecker
Advocate

We use a communal printer and it would be nice to have the name of the person printing, the date and the time printed along the extreme edge of the drawing.

Vagulus
Collaborator

I am trying to do just what these people are seeking.

Such a facility exists in AutoCAD, so the concept is feasible.

It sure has my support.

iUser
Advocate

@Yijiang.Cai  - Do you know if there is an easy way to add custom triggers to Inventor? Our company is also after a "Event Trigger Before Print". We need to see who printed the drawings last and the date it was printed (for office and workshop use). 

 

Voted 👍

Yijiang.Cai
Autodesk

@iUser, I look into the Inventor API, and there is no print event API provided. That means we need some more work on event trigger for print in iLogic. Could you have more details about the workflow how your company get it done now? Thanks!

pball
Mentor

@iUser, It is possible using an Addin or maybe VBA to catch the printing event. Below is a snippet of the event code I'm using in my visual basic addin. Please make a post on the Inventor iLogic and VB.net Forum if you'd like help with this.

 

 

 

 

        Private Sub m_UserEvents_OnActivateCommand(CommandName As String, Context As NameValueMap) Handles m_UserEvents.OnActivateCommand
            If ThisApplication.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
                'Add date to drawing when printing or exporting as PDF/DWG
                If (IsToken("AppFilePrintCmd AppFileExportPDFCmd AppExportDwgCmd", CommandName, " ")) Then AddDrawingDate(CommandName)
            End If
        End Sub

        Private Sub m_UserEvents_OnTerminateCommand(CommandName As String, Context As NameValueMap) Handles m_UserEvents.OnTerminateCommand
            If ThisApplication.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
                'Remove date from drawing when printing or exporting as PDF/DWG
                If (IsToken("AppFilePrintCmd AppFileExportPDFCmd AppExportDwgCmd", CommandName, " ")) Then AddDrawingDate(CommandName, True)
            End If
        End Sub

 

 

 

iUser
Advocate

@Yijiang.Cai,  I have written some iLogic which gets event triggered before save. This uses the Inventor general options user name and current date from windows and adds it to the title block. The problem with this is that every time I save, the date gets changed so I cant see when last the drawing was printed. Our workshop has at any time between 2000 - 5000 active drawings in different departments. We build custom engineering equipment and constantly have to change our 3D models so unfortunately we cannot track revisions. 

 

iUser_0-1646160257336.png

 

@pball, I haven't really used VBA. Im wondering how other companies keep track of all their previous prints. I was thinking of creating a PFD library that our workshop guys have access to (Read rights only). By using VBA maybe one could export a PDF when printing to a location on the network. If the PDF drawing already exists, then shift old PDF to archive and keep latest PDF for everyone to have access to?

 

This is the iLogic I am using:

 

Dim odrawdoc As DrawingDocument
odrawdoc = ThisApplication.ActiveDocument
customPropertySet = odrawdoc.PropertySets.Item("Inventor User Defined Properties")
Try
      prop = customPropertySet.Item("Plotdatestamp")
Catch
      customPropertySet.Add("", "Plotdatestamp")
End Try
Try
Dim PlotDate As Date
PlotDate = Now

iProperties.Value("Custom", "Plotdatestamp") = PlotDate
Catch
End Try

oNAME = ThisApplication.GeneralOptions.UserName
Try
      prop = customPropertySet.Item("PrintName")
Catch
      customPropertySet.Add("", "PrintName")
End Try

iProperties.Value("Custom", "PrintName") = oNAME

InventorVb.DocumentUpdate()   
Yijiang.Cai
Autodesk
Status changed to: Future Consideration

Many thanks for posting the idea, and tracked as [INVGEN-3632].

mgrenier1
Advocate

Would be nice to have a "before print" iLogic trigger so we can trigger some iLogic rules or open a form before printing a drawing

And Export

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

Submit Idea