Jump to content

Explode block placed with VBA


wbluem88

Recommended Posts

I want to place a block using a VBA routine, and then explode that block within the same routine. After a few searches on Google and this forum, it seems to be quite a pain to do. I was hoping someone had a solution. This code works fine everywhere else, but the block just will not explode.

 

Dim varPoint As Variant
Dim varArray As Variant
Dim dblAngle As Double
Dim objTrap As AcadEntity
varPoint = ThisDrawing.Utility.GetPoint(, vbCr & "Select insertion point")
dblAngle = ThisDrawing.Utility.GetAngle(varPoint, vbCr & "Select trap direction")
objTrap = ThisDrawing.ModelSpace.InsertBlock(varPoint, "trapsink.dwg", varScale, varScale, 1, dblAngle)
varArray = objTrap.Explode

Link to comment
Share on other sites

First, is the block able to be exploded?

 

I don't know if this works in VBA (it does in lisp)

Try preceding the file name with an *

Link to comment
Share on other sites

I want to place a block using a VBA routine, and then explode that block within the same routine. After a few searches on Google and this forum, it seems to be quite a pain to do. I was hoping someone had a solution. This code works fine everywhere else, but the block just will not explode.

 

Dim varPoint As Variant
Dim varArray As Variant
Dim dblAngle As Double
Dim objTrap As AcadEntity
varPoint = ThisDrawing.Utility.GetPoint(, vbCr & "Select insertion point")
dblAngle = ThisDrawing.Utility.GetAngle(varPoint, vbCr & "Select trap direction")
objTrap = ThisDrawing.ModelSpace.InsertBlock(varPoint, "trapsink.dwg", varScale, varScale, 1, dblAngle)
varArray = objTrap.Explode

 

This is working for me:

 
Set objTrap = ThisDrawing.ModelSpace.InsertBlock(varPoint, "trapsink.dwg", varScale, varScale, 1, dblAngle)
varArray = objTrap.Explode
objTrap.Delete

 

~'J'~

Link to comment
Share on other sites

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...