Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Getting started with SE Automation - I need some help

Experimenter
Experimenter

Hello everyone,

 

I am new to SE scripting, and I need some help.

I want to automate some image generation with SE, taken of different views of an assembly.

 

I think this should be a very easy task, but I cannot solve it. Smiley Frustrated

 

Here my code (VBA):       (hint: I am from Germany, so my installation is german.)

 

Sub TesteSolidEdge()

Dim SEBaugruppe As SolidEdgeAssembly.AssemblyDocument
Dim SEInstanz As SolidEdgeFramework.Application
Dim SEView As SolidEdgeFramework.View

Set SEInstanz = CreateObject("SolidEdge.Application")
Set SEBaugruppe = SEInstanz.Documents.Open("C:\Temp\Test\Einmessen.asm")
Set SEView = SEInstanz.ActiveWindow.View

SEInstanz.Application.Visible = True
SEInstanz.DisplayFullScreen = True

' Ansichten ablegen
SEView.ApplyNamedView "vorne"
SEView.Fit
SEBaugruppe.SaveAs "c:\temp\vorne.pdf", , False

' !!! "hinten" doesn't exist as a NamedView !!! how can I use the cube in VBA? there you can switch to the rear (german: "hinten") view.
'SEView.ApplyNamedView "hinten"
'SEView.Fit
'SEBaugruppe.SaveAs "c:\temp\hinten.pdf", , False

SEView.ApplyNamedView "rechts"
SEView.Fit
SEBaugruppe.SaveAs "c:\temp\rechts.pdf", , False

SEView.ApplyNamedView "oben"
SEView.Fit
SEBaugruppe.SaveAs "c:\temp\oben.pdf", , False

End Sub
-------------------------------------------------------------------------------------------------------
Sub TesteSolidEdge2()

Dim SEInstanz As SolidEdgeFramework.Application

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

SEInstanz.StartCommand AssemblyViewTopView

' !!! AssemblyViewRearView doesn't exist as a command (but as stated above: you can switch to it by using the cube of the GUI)
' SEInstanz.StartCommand AssemblyViewRearView

End Sub

 

My first problem is to find a solution to change the view to the rear view. It seems there is neighter a named view nor a command for a rear view. I installed Spy for SE and tried to find some hints when using the cube. With the cube I can switch to the rear side (highlighted yellow): 

Abb2.PNG 

How can I implement/use this function?

 

My second problem is the documentation. I cannot find any proper documentation of the API. Simple example: I used the command "AssemblyViewTopView", so I know it exists. But when I search for it in the ST8 SDK help, I get no results (I would expect a description of the command):

Abb1.PNG

Where I can get an API documentation? Or is there any other knowledge base?

 

I appreciate any help, thanks in advance!

 

Kind regards,

Samuel

11 REPLIES 11

Betreff: Getting started with SE Automation - I need some help

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Hi @_Sam_

 

 

 

regarding the Rear (Back) View I have looked into a very old macro I did at least 15 years ago.

 

And there I used following line for the back view

 

...

Call SEApp.StartCommand(PartViewBackView)

...

 

 

 

And the same command (macro) still is working with ST10 and in ASM too!

 

 

 

 

regards
Wolfgang

Betreff: Getting started with SE Automation - I need some help

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Hi @_Sam_

 

 

 

reagarding Your second question I personally only can recommment to use the object catalog (F2) to browse trough all available proeprties,  calls, etc.

 

Those helped me the most

 

 

regards
Wolfgang

Betreff: Getting started with SE Automation - I need some help

Experimenter
Experimenter

Hello Wolfgang,

 

Yes, my first point of contact is the object catalog, too.

It contains all relevant things and you can learn a lot of it, but only with trial and error.

But this is its weakness. If trial and error leads to no acceptable result, what is the case especially if you don't know anything, then it doesn't help.

 

Example: I didn't know, there is a command "PartViewTopView". I was looking in the assembly section, because I am working with assemblies in the environment of an assembly. What I needed then, was a hint, that I can use part commands while working with assemblies. Ideally with some links and code examples. Is there anything close to this? Or do you all learn programming SE with trial and error?

 

And thanks for solving my first problem! Smiley Happy

 

Regards,

Samuel

Betreff: Getting started with SE Automation - I need some help

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Hi @_Sam_

 

 

 

this is the hard way of SE API programming!

 

 

IMHO there is no really good tutorial, overview about all possible calls, functions and properties.

You have to learn it from the hard core tour.

 

And a very good help here is Jason Newells Solid Edge Spy.

 

Go to the developer forum and do a search for it.

 

 

regards
Wolfgang

Betreff: Getting started with SE Automation - I need some help

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Hi @_Sam_

 

 

 

here is the mentioned link and the SE SPY TOOL link:

 

https://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Blog/Spy-for-Solid-Edge-Introdu...

 

 

PS.: You should ask Your programming question in the Developers Forum at all, You will get beter and faster answer there!

 

regards
Wolfgang

Betreff: Getting started with SE Automation - I need some help

Experimenter
Experimenter

Hello again,

 

I tried to post in the dev forum, I don't know why it didn't appear there.

 

As mentioned above, I already installed the spy tool. Smiley Very Happy 

It's really cool, but again: It is for trial and error... Or am I wrong?

 

Regards,

Sam

Betreff: Getting started with SE Automation - I need some help

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Hi @_Sam_

 

 

I cann't say why You were not able to post, do not know any reason.

 

But You have spoken about the Object Catalogue but not about the Spy Tool of SE

 

The Solid Edge Spy shows any command You are using interactiveley so that You can find the appropriate command in use.

 

And PS.: You should follow the Community Guidelines shown by @AmyReyes find under 

 

https://community.plm.automation.siemens.com/t5/Solid-Edge-Forum/Solid-Edge-Community-Guidelines-Rea...

 

always use the linked user name "@username" to let those people see that You have answered a post, as well as You should mark helpful answers as solution and spending Kudos for this help

 

regards
Wolfgang

Betreff: Getting started with SE Automation - I need some help

Experimenter
Experimenter

Hello @hawcad,

 

I didn't saw any community rules, sry for that. Till now I only visited the Solid Edge Developer forum, all other forums aren't interesting for me. I promise to improve.

 

With the spy tool i unsuccesfully tried to get the function of the cube, i wrote this in my first post. But I think I need to watch the video first, i see a lot of commands certainly I didn't call. I have no sound on the PC at work, I have to do this at home.

 

And I hope there is an admin who will move this topic in the correct place. Smiley Wink

 

Regards,

Sam

Re: Getting started with SE Automation - I need some help

Phenom
Phenom

I"m not a programmer- not even close- but I do know several CAD systems. I was wondering if you would be able to set the viewpoint to a specfic value. 

Say vpoint(x,y,z) or vpoint(0,0,-1) instead of relying on "canned" views.

 

I don't know- just throwing it out there. Maybe someone can run with the idea.