Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add block at cursor

Status
Not open for further replies.

jrice174

Civil/Environmental
Joined
Nov 8, 2004
Messages
129
Location
US
In order to add a block reference in a drawing using VBA the code is

ThisDrawing.ModelSpace.InsertBlock Pt1, BlockName, 1, 1, 1, 0

but that assumes that I want to put it in a specified location. How can I bring the block in on the cursor so the user can place the block wherever they want it?
 
You can use utility.getpoint to get a point, but you won't get the block to 'ghost' with the cursor.

It's pretty hard to get that using VBA. It's easier to obtain using LISP.

The other alternative is to put the block in a pallet. This will create a button that you can use to specify layer, scale, rotation etc.
 
Thanks so much for your help. I think I'll just move it to the correct location after I create it.
 
Yes- That's what I'd do. Have your code insert the item, and move-last, then "@" for last point used (insertion point) and pause for next user input. The block should appear at the cursor, with the next pick being the drop point. If you don't want rotation, [enter] past that step and close the command.

I run this very operation as a simple macro, with the above steps. Don't know the exact code you'd use for Vb, but this is the logic, anyway.

Good luck-
C. Fee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top