Function "PushElementOnStack" working correct.
OK back to the startpoint.
In your code you have try to set the variable TopElt. But TopElt keeps empty because your Element was not found.
You have to understand that inside a DRAFT file there are elements other as in TOP file.
My Example
@112 inside TOP file
@112 inside DRAFT file
IN DRAFT we are talking about a sub element of other elements (Views -> View -> Reference -> Elements -> Element @112)
We have to check the names of each Element in the draft
Code: Select all
TopApp = New TopSolid.Application
Dim TopDoc3D As TopSolid.Document ‘My mistake: its possible for DRAFT and for TOP
TopDoc3D = TopApp.CurrentDocument
Dim myelements As String
For Each TopElt In TopDoc3D.Elements
myelements = myelements & Chr(13) & TopElt.Name
Next
MsgBox(myelements)
Result of messagebox
Code: Select all
TopElt = TopDoc3D .Elements.Item("$SET_ENTITIES_VIEWS")
'OR
TopElt = TopDoc3D.SearchElementByName("$SET_ENTITIES_VIEWS")
Dim TopElt2 as TopSolid.Element
myelements = ""
For Each TopElt2 In TopElt.Elements
myelements = myelements & Chr(13) & TopElt2.NameOrIdentifier
Next
MsgBox(myelements)
Result of messagebox
So we got the element position.
That is what i know. We have to get inside sub groups to get the real element.
So my last "For Each" could do this.
Code: Select all
For Each TopElt2 In TopElt.Elements
if TopElt2.identifier = "@43" then
exit for
end if
Next
With TopApp
.PushElementOnStack(TopElt2)
'We have to check what kind of lob you need? Analyse? And then we have to modify it like in my email to you.
.ExecuteMacro("C:\Missler\V619\d\frame\view\l\edmodel.lob")
End With
'We have to check what kind of lob you need? Analyse?
Then use the modified version of my Post:
#p5776 (scroll to bottom of post)
VB TIPP:
You have to debug your VB program.
Use "PAUSE" (red dot on left in the image below) to pause your program and use "mouse over" to analyze the current setting of variables like the TopElt2
before you "PushElementOnStack".