How to set osnap mode from VBA?

Discussion in 'AutoCAD' started by qj91702, Jul 13, 2004.

  1. qj91702

    qj91702 Guest

    I went through a great deal trying to find the command or method to set osnap mode in VBA with no luck. What I'm trying to do is to write a macro flag out the point description, but first it has to snap to the point. I would think there must be a simple way but I just don't know how. I would be very appreciated if any one can shed some light on this thing.
     
    qj91702, Jul 13, 2004
    #1
  2. ThisDrawing.SetVariable "OSMODE", <new value>
     
    Frank Oquendo, Jul 13, 2004
    #2
  3. qj91702

    qj91702 Guest

    Frank:
    Thank you for your reply. That solves my problem.

    I got two more questions I wonder if you could help me:

    1. To draw a leader line in VBA you need to have all vertex points before you use "ThisDrawing.ModelSpace.AddLeader" method. You won't be able to see a dynamic line like you do in AutoCAD. Is there a way you can simulate that?

    2. How do you deselect a object after you have finished whatever you want to do with it? I tried "AcadSelectionSet.delete" or "AcadSelectionSet.erase" but doesn't work.

    Thank you or anyone who could help me solve those puzzles.
     
    qj91702, Jul 13, 2004
    #3
  4. qj91702

    Dragnsbld Guest

    Since it looks like you are using a SS you need to Clear the SS -> SS.Clear, then you can delete the SS completely without losing the objects stored in it.
     
    Dragnsbld, Jul 13, 2004
    #4
  5. qj91702

    qj91702 Guest

    Here's how I did it:

    Private Sub test(ByVal PickPoint As Variant)

    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.PickfirstSelectionSet

    ...
    code
    ...

    ssetObj.clear
    ssetObj.delete

    End sub

    When it's done the object is still selected. What am I missing?
     
    qj91702, Jul 13, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.