API Block instances

Discussion in 'SolidWorks' started by Wayne Tiffany, Aug 12, 2004.

  1. I have a drawing with a couple block definitions in it. Each definition has
    2 or 3 instances in the drawing. I select one instance and run my macro.
    When I run this: selType = SelMgr.GetSelectedObjectType2(1), it returns type
    93, which is swSelBLOCKDEF, rather than the expected type 87 of
    swSelBLOCKINST.

    Any thoughts as to why it would see it as the definition, rather than the
    selected instance? If that's the way it is, then how do I identify the
    particular instance that the user selected? I can get all instances of a
    definition, but how will I identify the particular selected one?

    WT
     
    Wayne Tiffany, Aug 12, 2004
    #1
  2. Wayne,

    swSelBLOCKINST = 93 ' "BLOCKINST"
    swSelFTRFOLDER = 94 ' "FTRFOLDER"
    swSelSKETCHREGION = 95 ' "SKETCHREGION"
    swSelSKETCHCONTOUR = 96 ' "SKETCHCONTOUR"
    swSelBLOCKDEF = 99 ' "BLOCKDEF"

    This is directly out of the BAS file of 2003. and it is the same in 2004 I
    don't have anything older to reference. So according to this it is
    returning the block instance not the def and therefor you have no problem.
    What version are you running anyway?

    Corey
     
    Corey Scheich, Aug 12, 2004
    #2
  3. How do you know that swSelBLOCKINST = 93? When I count down through
    swSelectType_e, I get it as 87.

    WT
     
    Wayne Tiffany, Aug 12, 2004
    #3
  4. Ah-ha! Found it! If you open the file swConst.bas file and go to the
    swSelectType_e section, then it becomes obvious that my previous method of
    manually counting down through what is displayed in the API Help is not only
    time consuming, but also inaccurate. Turns out that there are "holes" in
    the numbering sequence: that is not all numbers are used.

    Actually, I think I knew this some years ago and obviously forgot it. Oh,
    well, humble hat is on and back to work. :)

    WT
     
    Wayne Tiffany, Aug 12, 2004
    #4
  5. The object browser is the other way to do this (if you are using the
    swconst.dll).

    Evan
     
    Evan T. Basalik, Aug 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.