Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
isocam
1014 Views, 2 Replies

Export "DWG" select a face using a VBA macro

Can anybody help????

 

I have the following code that outputs an AutoCAD "Dwg" file of an extruded face. The output is a 2d profile.

 

        Dim oDoc As PartDocument

        Set oDoc = ThisApplication.ActiveDocument

        Dim oBaseFace As Face

        Set oBaseFace = oDoc.SelectSet.Item(1): THIS IS THE PROBLEM LINE!!!!

        Dim Cm As CommandManager

        Set Cm = ThisApplication.CommandManager

        Call Cm.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent,"C:\Test.dwg")

        Dim oCtrlDef As ButtonDefinition

        Set oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand")

        Call oCtrlDef.Execute

 

It works fine but I have to pre-select the face of the extrusion manually before running the macro. Does anybody know how to automatically select the face using the VBA macro rather than manually selecting the face first?

 

All I am doing is creating a sketch (Lines/Arcs/Circles) then extruding the sketch. Nothing else!

 

Many thanks in advance!!!!

 

Darren