Hi before asking this question I did some searching on forums if someone already asked similar question and I couldn't find anything. Is there a way to know from part/assembly if they got a drawing form them too (no of same/similar name) and then if it could be exported to as pdf.
Thank you.
Solved! Go to Solution.
Hi before asking this question I did some searching on forums if someone already asked similar question and I couldn't find anything. Is there a way to know from part/assembly if they got a drawing form them too (no of same/similar name) and then if it could be exported to as pdf.
Thank you.
Solved! Go to Solution.
Solved by Ralf_Krieg. Go to Solution.
Hello
No. You can use Vault or some other CAD data managment software who keeps track of this. In an very, very simple way, you could write an iLogic that writes an iProp (e.g. "RefedDrawing") with fulldocumentname of the drawing in the referenced part/assembly document on save drawing.
But:
- Don't move any of the documents wihtout updating RefedDrawing-Property
- Don't place more than one model onto drawing, keep a 1:1 relationship
- Delete iProp in model when delete last view in drawing
- Delete iProp when delete drawing
- and many more manual ToDo
Hello
No. You can use Vault or some other CAD data managment software who keeps track of this. In an very, very simple way, you could write an iLogic that writes an iProp (e.g. "RefedDrawing") with fulldocumentname of the drawing in the referenced part/assembly document on save drawing.
But:
- Don't move any of the documents wihtout updating RefedDrawing-Property
- Don't place more than one model onto drawing, keep a 1:1 relationship
- Delete iProp in model when delete last view in drawing
- Delete iProp when delete drawing
- and many more manual ToDo
Sorry I don't use vault, so in that case it is not possible to create pdf of idw's from assembly in case part numbers/subassembly names are name same as idw's?
Sorry I don't use vault, so in that case it is not possible to create pdf of idw's from assembly in case part numbers/subassembly names are name same as idw's?
Hi guys. I picked up handy, simple little trick a while back that may help you in this situation. It's not a perfect solution, but it's better than nothing, and a step in the right direction. And it leads me to believe that maybe the model file may actually know if it has a drawing, due to how it works. I don't know if you have noticed this subtle convenient tool, and I don't recall which version of Inventor it became available, but when you left click (which selects it) on the top node in your model document's model browser (usually shows the name of the model), then right click, then choose "Open Drawing" from the right-click menu, if you have created a dedicated drawing of this model before and saved it, it will open that drawing. Using this knowledge and technique, I looked up which command is called/used in that situation. It is "CMxOpenDrawingCmd". It won't work by itself, but if you simulate clicking on that top browser node just before executing it, it works the same as the manual process. So I created a simple little iLogic rule that does this.
Here is that rule:
ThisDoc.Document.BrowserPanes.Item("Model").TopNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("CMxOpenDrawingCmd").Execute2(False)
Obviously, you can change the document reference how you want, but I'm pretty sure the model document has to be fully open and active (visibly) for this to work. And you could most likely replace "Model" with the 'InternalName' "PmDefault", if there is a language barrier.
I don't use Vault either, and don't even have it installed, and I haven't recently/previously had the model's drawing open either, so it's not still in memory or anything, but this still works for me. So, to me that means...the model document must somehow not only know IF it has a drawing, but also how to open it. I don't know where this information may be stored, or how to retrieve it yet, but at least there's hope, right. 😉
PS: After it opens the drawing document, that drawing becomes the 'active' document, so you can use ThisApplication.ActiveDocument to retrieve it and/or its FullFileName.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS
Wesley Crihfield
(Not an Autodesk Employee)
Hi guys. I picked up handy, simple little trick a while back that may help you in this situation. It's not a perfect solution, but it's better than nothing, and a step in the right direction. And it leads me to believe that maybe the model file may actually know if it has a drawing, due to how it works. I don't know if you have noticed this subtle convenient tool, and I don't recall which version of Inventor it became available, but when you left click (which selects it) on the top node in your model document's model browser (usually shows the name of the model), then right click, then choose "Open Drawing" from the right-click menu, if you have created a dedicated drawing of this model before and saved it, it will open that drawing. Using this knowledge and technique, I looked up which command is called/used in that situation. It is "CMxOpenDrawingCmd". It won't work by itself, but if you simulate clicking on that top browser node just before executing it, it works the same as the manual process. So I created a simple little iLogic rule that does this.
Here is that rule:
ThisDoc.Document.BrowserPanes.Item("Model").TopNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("CMxOpenDrawingCmd").Execute2(False)
Obviously, you can change the document reference how you want, but I'm pretty sure the model document has to be fully open and active (visibly) for this to work. And you could most likely replace "Model" with the 'InternalName' "PmDefault", if there is a language barrier.
I don't use Vault either, and don't even have it installed, and I haven't recently/previously had the model's drawing open either, so it's not still in memory or anything, but this still works for me. So, to me that means...the model document must somehow not only know IF it has a drawing, but also how to open it. I don't know where this information may be stored, or how to retrieve it yet, but at least there's hope, right. 😉
PS: After it opens the drawing document, that drawing becomes the 'active' document, so you can use ThisApplication.ActiveDocument to retrieve it and/or its FullFileName.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS
Wesley Crihfield
(Not an Autodesk Employee)
If the drawing is in the same folder, you can try to open every drawing (.idw or .dwg file) invisibly and check to see if DrawingDocument.ReferencedDocuments[1] is the same as the model (AssemblyDocument or PartDocument).
If it's not in the same folder, you could try checking folders recursively, but I'm pretty sure this would take a long time.
If the drawing is in the same folder, you can try to open every drawing (.idw or .dwg file) invisibly and check to see if DrawingDocument.ReferencedDocuments[1] is the same as the model (AssemblyDocument or PartDocument).
If it's not in the same folder, you could try checking folders recursively, but I'm pretty sure this would take a long time.
Hello
This works only if the drawing has the same name as the model document and is saved in the same folder. As it looks like, Autodesk has done a simple replave ipt/iam with idw/dwg and open the file if exist. Or am I missed something?
@SometimesInventorMakesMeAngry
Yes, if there's only one big folder for all documents, it will take a long time searching. It's the same as a Pack'n Go with search for drawings option. Works well with 10 files, but not with 10.000.
As suggested in my last post, use an iLogic to write the drawing name to the model document. Create two external rules (WriteReferencingDoc and OpenReferencingDraweing) and paste in the code below. Open the iLogoc Eventrigger dialog. Add the WriteReferencingDoc rule to the Drawing - On save document event. After this, on every save of the drawing, the full path of the drawing will be written to the first referenced document.
If you run the OpenReferencingDrawing rule from the open model document, it wil check if drawing exists and open it. From there you can go on with an export to PDF routine.
WriteReferencingDoc
Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oRefedDoc As Document = ThisDoc.Document.ReferencedDocuments.Item(1)
Dim oPropSet As PropertySet = oRefedDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
Try
oPropSet.Add(oDrawDoc.FullFileName,"ReferencingDrawing")
Catch
If Not oPropSet.Item("ReferencingDrawing").Value=oDrawDoc.FullFileName Then
oPropSet.Item("ReferencingDrawing").Value = oDrawDoc.FullFileName
End If
End Try
OpenReferencingDrawing
Dim oDoc As Document = ThisDoc.Document
Dim sPath As String
Dim oProp As Inventor.Property = Nothing
For Each oProp In oDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
If oProp.Name = "ReferencingDrawing" Then
sPath = oProp.Value
Exit For
End If
Next
If oProp Is Nothing
MsgBox("iProperty 'ReferencingDrawing' not found. Exit.")
Exit Sub
End If
If System.IO.File.Exists(sPath) Then
ThisApplication.Documents.Open(sPath)
Else
If MsgBox("Drawing '" & sPath & "' doesn't exist. Clear iProp?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
oProp.Value = ""
End If
End If
Hello
This works only if the drawing has the same name as the model document and is saved in the same folder. As it looks like, Autodesk has done a simple replave ipt/iam with idw/dwg and open the file if exist. Or am I missed something?
@SometimesInventorMakesMeAngry
Yes, if there's only one big folder for all documents, it will take a long time searching. It's the same as a Pack'n Go with search for drawings option. Works well with 10 files, but not with 10.000.
As suggested in my last post, use an iLogic to write the drawing name to the model document. Create two external rules (WriteReferencingDoc and OpenReferencingDraweing) and paste in the code below. Open the iLogoc Eventrigger dialog. Add the WriteReferencingDoc rule to the Drawing - On save document event. After this, on every save of the drawing, the full path of the drawing will be written to the first referenced document.
If you run the OpenReferencingDrawing rule from the open model document, it wil check if drawing exists and open it. From there you can go on with an export to PDF routine.
WriteReferencingDoc
Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oRefedDoc As Document = ThisDoc.Document.ReferencedDocuments.Item(1)
Dim oPropSet As PropertySet = oRefedDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
Try
oPropSet.Add(oDrawDoc.FullFileName,"ReferencingDrawing")
Catch
If Not oPropSet.Item("ReferencingDrawing").Value=oDrawDoc.FullFileName Then
oPropSet.Item("ReferencingDrawing").Value = oDrawDoc.FullFileName
End If
End Try
OpenReferencingDrawing
Dim oDoc As Document = ThisDoc.Document
Dim sPath As String
Dim oProp As Inventor.Property = Nothing
For Each oProp In oDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
If oProp.Name = "ReferencingDrawing" Then
sPath = oProp.Value
Exit For
End If
Next
If oProp Is Nothing
MsgBox("iProperty 'ReferencingDrawing' not found. Exit.")
Exit Sub
End If
If System.IO.File.Exists(sPath) Then
ThisApplication.Documents.Open(sPath)
Else
If MsgBox("Drawing '" & sPath & "' doesn't exist. Clear iProp?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
oProp.Value = ""
End If
End If
Can't find what you're looking for? Ask the community or share your knowledge.