Reply

Find related Draft Document for Part Document

[ Edited ]

 

Hi all.

I want write code in VB. It must to find draft document, which related with active (or known) Part document, and get it (draft document's) properties.

Please, help me! Solid Edge SPY didn't help me(((

 

Posted by: Anton Bykov
Post date: 6/8/2010 2:30:24 AM

12 REPLIES

RE: Find related Draft Document for Part Document

[ Edited ]

You must use the RevisionManager to find the Draft

 

Dim objApp As RevisionManager.Application

Set objApp = CreateObject("RevisionManager.Application")

'Path_Name is a string where you have the Drafts.

objApp.WhereUsedCriteria("*.dft", False) = Path_Name

'first Draft

draft_name1 = objApp.FindWhereUsed(part_name)

 

'for more drafts for the Part call:

draft_name2 = objApp.FindWhereUsed()

in loop

 

 

 

Posted by: JR
Post date: 6/8/2010 8:25:34 PM

RE: Find related Draft Document for Part Document

[ Edited ]

 

JR, I try use follow code:

 

    Dim objApp As SolidEdgeFramework.Application

    Dim objRev As RevisionManager.Application

    Dim objRevDft As RevisionManager.Document  'Right?

    Set objApp = GetObject(, "SolidEdge.Application")

    Set objRev = CreateObject("RevisionManager.Application")

    pathName = OccDoc.Path '---path "D:\TestVb"

    partName = OccDoc.Name '---name of document "Test.par"

    objRev.WhereUsedCriteria("*.dft", False) = pathName '---As String

    objRevDft = objRev.FindWhereUsed(partName) '---As Object

    dftName = objRevDft.FullName '---As String

    MsgBox dftName  '----Nothing display----

    Set objApp = Nothing

    Set objRev = Nothing

Something wrong, becouse dftName is nothing.

 

 

Posted by: Anton Bykov
Post date: 6/9/2010 1:34:50 AM

RE: Find related Draft Document for Part Document

[ Edited ]

the partName must be a FullName with path in "objRevDft = objRev.FindWhereUsed(partName)"

and objRevDft is a String and not Object

 

Posted by: JR
Post date: 6/9/2010 2:01:12 AM

RE: Find related Draft Document for Part Document

[ Edited ]

 

JR, yeah, it worked, thank you!

And now I want to get properties this draft document without open it. Is it posible?

 

 

Posted by: Anton Bykov
Post date: 6/9/2010 2:21:31 AM

RE: Find related Draft Document for Part Document

[ Edited ]

Yes, with SolidEdgeFileProperties:

 

Dim objpropSets As SolidEdgeFileProperties.PropertySets

Dim objprops As SolidEdgeFileProperties.Properties

Dim objprop As SolidEdgeFileProperties.Property

 

Set objpropSets = CreateObject("SolidEdge.FileProperties")

Call objProps.Open(dftName)

Set objProps = objProps("Custom")

Set objProp = objProp(YourPropName) 'YourPropName is the name of the property as String

'or for all properties

For i = 0 To propSets.Count-1

List1.AddItem (propSets(i).Name)

For j = 0 To propSets(i).Count-1

ListView1.AddItem (" " & propSets(i)(j).Name & " = " & propSets(i)(j).Value)

Next j

Next i

 

'don't forget all object set to nothing and close the propsets

objpropSets.Close

 

have fun

JR

 

Posted by: JR
Post date: 6/9/2010 2:49:33 AM

RE: Find related Draft Document for Part Document

[ Edited ]

Thank you!

It's realy useful!!!

 

Posted by: Anton Bykov
Post date: 6/9/2010 6:23:32 PM

RE: Find related Draft Document for Part Document

[ Edited ]

 

I slightly corrected your code:

 

Set objropSets = CreateObject("SolidEdge.FileProperties")

Call objpropSets.Open(dftName)

Set objprops = objpropSets.Item("Custom")

Set objprop = objprops.Item(YourPropName)

 

One more question. Is it posible to get options of sheets (SheetSetup.SheetSizeOption) without open draft document?

Thank you again!

 

Posted by: Anton Bykov
Post date: 6/9/2010 6:37:55 PM

RE: Find related Draft Document for Part Document

[ Edited ]

Posted By Frantic on 06/09/2010 11:37 PM

 

I slightly corrected your code:

 

Set objropSets = CreateObject("SolidEdge.FileProperties")

Call objpropSets.Open(dftName)

Set objprops = objpropSets.Item("Custom")

Set objprop = objprops.Item(YourPropName)

 

One more question. Is it posible to get options of sheets (SheetSetup.SheetSizeOption) without open draft document?

Thank you again!

 

 

Posted by: Anton Bykov
Post date: 6/9/2010 7:17:04 PM

RE: Find related Draft Document for Part Document

[ Edited ]

not that I know

 

 

Posted by: JR
Post date: 6/9/2010 7:42:14 PM