Jump to content

Recommended Posts

Posted

Hi,

 

I'm looking for a command to delet/erase my drawing that I draw true VBA. And I want to delete this drawing true a button. I can erase all the drawings. but I just want to erase only the drawing that I draw te last true that program.

sombody any idea?? It's for my school project.

 

regards

 

Thomy

Posted

If I’m following correctly:

 

If the entities require deletion within the scope of the routine then the routine should retain an object reference to them, perhaps via a Global variable, then call Entity.Delete.

 

If the entities persist longer than the duration of the routine – i.e., added to the document, closed, and then reopened – you may have to look into assigning XDATA to your entities via a custom Registered Application Name (DXF code 1001). When deletion is necessary your entities can be retrieved via a selection filter based on the Registered Application Name.

 

Or, your routine can create an save a custom Dictionary that records all the entities added. Later on, the Dictionary can be queried to find the entities that require deletion. The routines would need tom perform all the “house cleaning” to keep the Dictionary up to date.

Posted

Hi,

 

Do jou have an example of this code???

Posted

The VBA help section has a good explanation and example of how to use XData.

 

A filtered selection would use these components

 

Dim intCode(0) As Integer
Dim varData(0) As Variant
Dim TempObjSS As AcadSelectionSet

. . . . .

intCode(0) = 1001: varData(0) = "Test_Application"

‘code to insure Selection Set does not already exist
  On Error Resume Next
  ThisDrawing.SelectionSets.Item("TempSSet").Delete
  On Error GoTo 0

Set TempObjSS = ThisDrawing.SelectionSets.Add("TempSSet")
TempObjSS.Select acSelectionSetAll, , , intCode, varData

. . . . .

XData.jpg

Posted

Hi,

 

I use Cad 2008 and in the help I can't find somting like "setXdata" or somting simuler.

Posted

You first have to get to the "ActiveX Automation and VBA" section from help.

Help.jpg

Posted

Hi,

 

Which help do you use?? The 1 in VBA or in CAD.

Posted

Anything specific to AutoCAD can only be found in AutoCADs Help section as shown above.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...