Export Wizard with Visual Basic

Export Wizard with Visual Basic

hugo_wy
Contributor Contributor
1,745 Views
8 Replies
Message 1 of 9

Export Wizard with Visual Basic

hugo_wy
Contributor
Contributor

Hi.

I am using PowerShape 2015 R2 and Visual Basic 2010 Express.

I am doing a program and i am stuck with this situation.


I need do export everything that is VISIBLE.

 

If i use this macro and run it in PowerShape, it works fine.
FILE EXPORT WIZARD
NEXT
D:\Moldes\tmp_elec.dgk
EXPORTTYPE VISIBLE
WIZEXPORT
EVERYTHING PARTIALBOX

 

But if i use it with Visual Basic 2010, don´t work.
PSHAPE.Execute("FILE EXPORT WIZARD")
PSHAPE.Execute("NEXT")
PSHAPE.Execute("D:\Moldes\tmp_elec.dgk")      'It stops here. Don´t use the path.
PSHAPE.Execute("EXPORTTYPE VISIBLE")
PSHAPE.Execute("WIZEXPORT")
PSHAPE.Execute("EVERYTHING PARTIALBOX")

 

Note:
This works in Visual Basic, but don´t export everything that is VISIBLE, like "Workplanes" that aren´t activated.
PSHAPE.Execute("FILE EXPORT D:\Moldes\tmp_elec.dgk")

0 Likes
Accepted solutions (1)
1,746 Views
8 Replies
Replies (8)
Message 2 of 9

l.ponsaerts
Advocate
Advocate

Hi,

To export something I use the API code. Ex.g. to export a model to a AutoCad dwg file :

Public Sub WriteDWGFile()
Dim dwgfile As New Autodesk.FileSystem.File(Reg_OutputFolder & "\" & Frm_Main.g_Fname & ".dwg")
PSModel.Export(dwgfile, ExportItemsOptions.Selected, ExportWorkplanes.World)
End Sub

0 Likes
Message 3 of 9

hugo_wy
Contributor
Contributor

Hi.

 

The problem is not exporting what is selected. That i know how.

The issue is exporting what is visible. 

When i use the Visual Basic e gets stuck in the path of the file.

0 Likes
Message 4 of 9

luc_ponsaerts
Advocate
Advocate

Hi,

The example I gave was a hint...

The .Export function is using the property ExportItemsOptions, which can also take the value "Visible".

 

Public Sub WriteDWGFile()
Dim dwgfile As New Autodesk.FileSystem.File(Reg_OutputFolder & "\" & Frm_Main.g_Fname & ".dwg")
PSModel.Export(dwgfile, ExportItemsOptions.Visible, ExportWorkplanes.World)
End Sub

 

I didn't try this yet, but it should work.

0 Likes
Message 5 of 9

luc_ponsaerts
Advocate
Advocate
Accepted solution

I also looked at the custom core source.

In the source I found (simplified version)

PSHAPE.Execute("FORMUPDATE OFF");
PSHAPE.Execute("FILE EXPORT WIZARD", "TARGET UNKNOWN");
PSHAPE.Execute("NEXT", exportFile.Path);
PSHAPE.Execute("EXPORTTYPE VISIBLE");
PSHAPE.Execute("NEXT");

PSHAPE.Execute("EXPORTTYPE WORLD");

PSHAPE.Execute("WIZEXPORT");
PSHAPE.Execute("FORMUPDATE ON")

 

 

Message 6 of 9

hugo_wy
Contributor
Contributor

That works perfectly. 

Thanks a lot.

0 Likes
Message 7 of 9

corl_jammy74
Community Visitor
Community Visitor

It is hard to believe that  بازی انفجار

0 Likes
Message 8 of 9

corl_jamm_y74
Community Visitor
Community Visitor

Dim dwgfile As New Autodesk.FileSystem.File(Reg_OutputFolder & "\" & Frm_Main.g_Fname & ".dwg")
PSModel.Export(dwgfile, ExportItemsOptions.Selected, بازی انفجار آنلاین ExportWorkplanes.World)
End Sub

0 Likes
Message 9 of 9

corljam_m_y_
Community Visitor
Community Visitor

hats off to writer اپ انفجار

0 Likes