Get variables from a Draft

Valued Contributor
Valued Contributor

Hello,

 

is there a way to read out the variables from a draft document like

 

the weight Variable %{Masse|R13} or

the material Variable %{Material|R13}

 

have somebody a idea ??

 

 

Greetings Joachim

 

 

 

Posted by: Joachim Schuhböck
Post date: 2/8/2006 9:08:47 PM

2 REPLIES

RE: Get variables from a Draft

Valued Contributor
Valued Contributor

I want to read out the variables with following code:

 

Private objDoc As SolidEdgeDraft.DraftDocument

Private Backgrd As SolidEdgeDraft.Sheet

Private objBalloons As SolidEdgeFrameworkSupport.Balloons

Private objBalloon As SolidEdgeFrameworkSupport.Balloon

'

For Each Backgrd In objDoc.Sections(2).Sheets

/\

|--- Here i get a Error

The interface "SolidEdgeDraft.Sections" cannot be iniziert, since it does not have a standard characteristic.

 

 

 

 

Set objBalloons = Backgrd.Balloons

For Each objBalloon In objBalloons

 

If objBalloon.Callout 1 Then

GoTo continue:

End If

.

.

.

continue:

Next objBallon

Next Backgrd

 

 

I want to use this VB6 code in vb.net.

Somebody knows whats wrong here ???

 

 

Greeting JOachim

 

Posted by: Joachim Schuhböck
Post date: 2/13/2006 7:38:09 PM

RE: Get variables from a Draft

Valued Contributor
Valued Contributor

Hi Joachim,

 

.Net works a bit differently. You need to use the Items property of the Sections Class as it has no default property defined - Sections.Items(2) instead of just Sections(2), for the latter .Net requires a default property which isn't present in most (all?) of the SE Type Libraries. Next you need to use CType to convert the Sheets Property to IEnumerable in order to use For...Each instead of For i = 1 To Shhets.Count ...Next

 

Try this:

Dim se As SolidEdgeFramework.Application = _

Runtime.InteropServices.Marshal.GetActiveObject("SolidEdge.Application")

Dim dft As SolidEdgeDraft.DraftDocument = se.ActiveDocument

Dim sht As SolidEdgeDraft.Sheet

 

For Each sht In CType(dft.Sections.Item(2).Sheets, IEnumerable)

MessageBox.Show(sht.Name)

Next

 

 

Cheers

Calum

 

Posted by: Calum McLellan
Post date: 2/14/2006 2:41:53 AM