×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Add block at cursor

Add block at cursor

Add block at cursor

(OP)
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?

RE: Add block at cursor

I do a similar thing. I do a insert and then a move command. The user never knows the difference.

http://mechcad-insider.blogspot.com/
 
"The fear of the Lord is the beginning of wisdom"

RE: Add block at cursor

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.

RE: Add block at cursor

(OP)
Thanks so much for your help. I think I'll just move it to the correct location after I create it.

RE: Add block at cursor

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources