VBA from excel to update all drawing views in a dft file

Creator
Creator

Hello solid edge experts, 

I am trying to create a VBA in excel to open solid edge ST8

to open solid edge draft file and update all the drawing views in it which are outdated and save it.

The model is linked with excel and gets opened with VBA and did save as.

 

but i dont know the code to update drawing views.

I tried so many times but failed.

Please someone give me the code.

 

6 REPLIES

Re: VBA from excel to update all drawing views in a dft file

Phenom
Phenom

You need to run the updateviews command with the startcommand method

 


Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Const TESTFILE = "T:\vbtests\testcases\cube.dft"

Set objApp = GetObject(, "SolidEdge.Application")
Set objDoc = objApp.Documents.Open(TESTFILE)
' Call the StartCommand
Call objApp.StartCommand(CommandID:=DetailDrawingViewsUpdateViews)

Set objApp = Nothing
Set objDoc = Nothing
End Sub



Re: VBA from excel to update all drawing views in a dft file

Creator
Creator
I'll try tomorrow and confirm sir.

Re: VBA from excel to update all drawing views in a dft file

Creator
Creator

Thank you so much. it worked for me.

 

I have so many dimensions in my model.

based on my excel the model changes ,

therefore i need to delete or hide few dimensions in dft.

is there any code on that.

 

Also kindly advice where can i learn there codes.

I am completely new to VBA.

 

My SE version is 108.00.00

Re: VBA from excel to update all drawing views in a dft file

Phenom
Phenom
What you ask for is surely possibile, the most difficult part is how to identify the dimensions you want to delete\hide.

You need to browse all the dimension in the dimensions collection of a draft and decide if keep, delete or hide it based on your rules.



Have a look at the "Programming with Solid Edge" in the learning center (information tab on the right).

https://docs.plm.automation.siemens.com/docs/se/108/api/webframe.html

This is a good start, also the Solid Edge developer forum

http://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/bd-p/SEDeveloperForum

Re: VBA from excel to update all drawing views in a dft file

Creator
Creator

Sir, 

What is the code to hide and show layers in dft.

Re: VBA from excel to update all drawing views in a dft file

Phenom
Phenom
here there is an example on the usage of layers.

https://docs.plm.automation.siemens.com/docs/se/108/api/SolidEdgeFramework~Layers~Item.html

you need to change the value of the layour property called "Show" from True to False

Again I suggest to read the SDK document referenced before.