I would like to use code to open a dwf markup and then republish the markup. Here is the code for the first step of making the dwf for the next person to check and mark up:
opath = ThisDoc.WorkspacePath()
oname = ThisDoc.FileName(False) ' without extension
DWFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If DWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = launchviewer
oOptions.Value("Publish_All_Component_Props") = 1
oOptions.Value("Publish_All_Physical_Props") = 1
oOptions.Value("Password") = 0
End If
'Set the destination file name
oDataMedium.FileName = opath & "\Markups\Check\" & oname & ".dwf"
'Publish document.
Call DWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
---------------------------------------------------------------------------------------------------------------------------------------------------
Once the dwf has been marked up I have the follwoing simple code to open the dwf as an overlay on the idw:
opath = ThisDoc.WorkspacePath()
oname = ThisDoc.FileName(False)
ThisApplication.Documents.Open(opath & "\Markups\Check\" & oname & ".dwf")
Now I want code to use the republish all sheets command and dont know how to go about that..... If I run the code I already use it doesn't retain the markups and just publishes a new dwf but I need to retain the markup history and the republish all sheets command does this but I don't know how to call that in Ilogic. Any help would be great! Thanks!
Hi,
Unfortunately, I did not find a DWF publish option for republish. I also did not find the ControlDefinition for it and no Command is triggered when you click "Republish Markup Sheets"
So it's not looking good 😞
I'll check if perhaps that option was just left out of the help file but actually is implemented in the API.
Cheers,
Hi,
I checked the list of control definitions before opening the drawing :-s
My colleague pointed out that the AddIn does provide ControlDefinitions, so you can achieve what you want. 🙂
I wrote a blog post about this:
http://adndevblog.typepad.com/manufacturing/2014/10/republish-markup-sheets.html
Cheers,
Thanks for the help adam. I have a problem though. I copied your code directly into a new Rule. I make sure I have a markup overlay then run the code and first I got a message saying set is no longer supported so I simply removed the word set. Next I get Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
I don't know what to do to fix it.....I am using inventor pro 2014
Well I thought it was working well and the code does but now it messes with inventor. For instance after running the code it will make every time I hit the open icon it brings in the overlay or if I hit save it makes a dwf.....
Here is the code I have:
SyntaxEditor Code Snippet
On Error Resume Next opath = ThisDoc.WorkspacePath() oname = ThisDoc.FileName(False) ThisApplication.Documents.Open(opath & "\Markups\Needs Revision\" & oname & ".dwf") Dim oCommandMgr As CommandManager oCommandMgr = ThisApplication.CommandManager ' Get the collection of control definitions Dim oControlDefs As ControlDefinitions oControlDefs = oCommandMgr.ControlDefinitions Call oCommandMgr.PostPrivateEvent( PrivateEventTypeEnum.kFileNameEvent,opath & "\Markups\Needs Revision\" & oname & "1.dwf") Call oControlDefs( "MarkupManager:Command: DWF Republish Markup Sheets").Execute Call oControlDefs( "MarkupManager:Command: DWF File Close").Execute System.IO.File.Delete(opath & "\Markups\Needs Revision\" & oname & ".dwf") ThisDoc.Launch(opath & "\Markups\Needs Revision\")
Hi,
Here is a suggestion to try:
>> >>
Use
oControlDefs("Command Name").Execute2(True)
instead of
oControlDefs("Command Name").Execute
That will execute the command synchronously. It will wait for the command to finish before continuing to the next program statement.
<< <<
Thanks,
Wayne