Reply

vb.NET --> Update active Draft's views?

[ Edited ]

Hi all,

I created a tool, which helps me to translate text in draft document to a different language. I use custom properties for the texts, which need to be translated and it works just fine... but after modifying the custom properties, I also need to update the views with "Update views"-button to update all the mapped values in the draft document. 

How could it be done with vb.NET? I have tried following:

Sub UpdateViews()        Dim objApp As SolidEdgeFramework.Application = Nothing        Dim objDocuments As SolidEdgeFramework.Documents = Nothing        Dim objDraft As SolidEdgeDraft.DraftDocument = Nothing        Dim objModelLinks As SolidEdgeDraft.ModelLinks = Nothing        Dim objModelLink As SolidEdgeDraft.ModelLink = Nothing        Dim i As Integer        Try            objApp = Marshal.GetActiveObject("SolidEdge.Application")            objdocuments = objApp.Documents            objDraft = objApp.ActiveDocument            objModelLinks = objDraft.ModelLinks

            For i = 1 To objModelLinks.Count                objModelLink = objModelLinks.Item(i)                objModelLink.UpdateViews()            Next        Catch ex As Exception            Console.WriteLine(ex.Message)            MsgBox("Kuvantojen päivitys ei onnistunut.")        End Try

    End Sub

This does update the views, but it doesn't update the callouts if the content of the callout hasn't change. Could someone help me? Thanks.

 

Posted by: Janne Heinonen
Post date: 2/2/2012 8:23:50 AM

1 REPLY

RE: vb.NET --> Update active Draft's views?

[ Edited ]

...and of course I solved it right after I posted this topic. Sorry about that, but here's the solution:

 

Sub UpdateViews()

Dim objApp As SolidEdgeFramework.Application = Nothing

Dim objDocuments As SolidEdgeFramework.Documents = Nothing

Dim objDraft As SolidEdgeDraft.DraftDocument = Nothing

Dim objModelLinks As SolidEdgeDraft.ModelLinks = Nothing

Dim objModelLink As SolidEdgeDraft.ModelLink = Nothing

Dim i As Integer

Try

objApp = Marshal.GetActiveObject("SolidEdge.Application")

objdocuments = objApp.Documents

objDraft = objApp.ActiveDocument

objModelLinks = objDraft.ModelLinks

 

For i = 1 To objModelLinks.Count

objModelLink = objModelLinks.Item(i)

objModelLink.UpdateViews()

Next

 

objDraft.UpdatePropertyTextDisplay()

 

Catch ex As Exception

Console.WriteLine(ex.Message)

MsgBox("Kuvantojen päivitys ei onnistunut.")

End Try

 

End Sub

 

Posted by: Janne Heinonen
Post date: 2/2/2012 8:29:44 AM