Extended Entity Data Filter

Discussion in 'AutoCAD' started by TomD, Mar 1, 2005.

  1. TomD

    TomD Guest

    Is it possible to filter for specific extended entity data beyond just the
    application name?

    (I've tried several times before and haven't had any success beyond the app
    name, so thought I'd post the question here before I try again.)
     
    TomD, Mar 1, 2005
    #1
  2. TomD

    TomD Guest

    Scratch that last question, I think I just figured out why it didn't work
    for me, before.

    Sample of successful filter variants, for anyone who may be wondering....

    vCod(0) = 1001: vVal(0) = kAppName
    vCod(1) = 1002: vVal(1) = "{"
    vCod(2) = 1040: vVal(2) = 54#
    vCod(3) = 1002: vVal(3) = "}"

    .....in previous attempts, I had neglected to put in the 1002/brackets
     
    TomD, Mar 1, 2005
    #2
  3. TomD

    fantum Guest

    You should be aware that it won't work for simpler (older?) entities: point, line, text, circle, arc, ... maybe others.
     
    fantum, Mar 1, 2005
    #3
  4. TomD

    TomD Guest

    Could you explain a little further, please?

    I've run some successful, albeit early, testing on some lightweight
    polylines this way, seemingly working fine.

    Any hard-learned lessons appreciated. ;)
     
    TomD, Mar 2, 2005
    #4
  5. What version of Autocad are you using ?
    I would have told you that you could never filter based on
    anything other than Application Name, but apparently that is not true.

    I am surprised ! Have you successfully filtered on all datatypes ?
    (strings, ...)
     
    Arnaud Lesauvage, Mar 2, 2005
    #5
  6. TomD

    fantum Guest

    Documentation and received wisdom notwithstanding, it is possible to filter a selection based on extended entity data beyond the appname in versions 2000 through at least 2005 for some entity types. These types include lightweight polyline, mtext, ellipse, etc. but do not include line, text, circle, etc.
     
    fantum, Mar 2, 2005
    #6
  7. TomD

    TomD Guest

    I've only tested with 2005, but could try 2004 if it would be helpful for
    you.

    The only successful filtering was by a 1010 3d point, so far. I plan to do
    some other testing, relatively soon, though, on something different that I
    already have XData in use with.

    I should clarify that I'm not doing anything too high end with it, so there
    could certainly be caveats. (I'm a "cad guy/designer" first, programming is
    an advanced hobby, I guess you could say.)

    Some of the code follow. It's simple enough that anyone following this
    thread could likely figure it out, fairly quickly, so I'm skipping that.
    (Also, if you're thinking that I shouldn't be finding a drainage area by a
    point stored in XData, I'd normally agree with you....lol......don't
    ask.....just testing an idea.)

    Function TagDrainageArea(oEnt As AcadEntity, vXyz As Variant, dCw As Double)
    As Boolean
    Dim vCod(5) As Integer, vVal(5) As Variant
    Dim dPnt(2) As Double
    dPnt(0) = vXyz(0): dPnt(1) = vXyz(1): dPnt(2) = vXyz(2)
    vCod(0) = 1001: vVal(0) = kAppName
    vCod(1) = 1002: vVal(1) = "{"
    vCod(2) = 1000: vVal(2) = "DrainageArea"
    vCod(3) = 1011: vVal(3) = dPnt 'World Space Position...moves with
    entity!
    vCod(4) = 1040: vVal(4) = dCw 'Weighted C
    vCod(5) = 1002: vVal(5) = "}"
    oEnt.SetXData vCod, vVal
    End Function

    When I ran the initial tests with the following function, I did get the
    appropriate entities returned.....at least it appears that I did. Again,
    the testing has not been thorough, by any means.

    Function GetAreasForPosition(vXyz As Variant) As AcadSelectionSet
    Dim vCod(4) As Integer, vVal(4) As Variant
    Dim dFocusPoint(2) As Double
    Dim oSet As AcadSelectionSet
    dFocusPoint(0) = vXyz(0): dFocusPoint(1) = vXyz(1): dFocusPoint(2) =
    vXyz(2)
    vCod(0) = 1001: vVal(0) = kAppName
    vCod(1) = 1002: vVal(1) = "{"
    vCod(2) = 1000: vVal(2) = "DrainageArea"
    vCod(3) = 1011: vVal(3) = dFocusPoint
    vCod(4) = 1002: vVal(4) = "}"
    Set oSet = SelSetInit("CEC-SD-STORM-ObjectCollector")
    oSet.Select acSelectionSetAll, , , vCod, vVal
    Set GetAreasForPosition = oSet
    End Function
     
    TomD, Mar 2, 2005
    #7
  8. TomD

    TomD Guest

    I certainly don't dispute what you're saying, I'm just basically confused as
    to why that would be. It wouldn't seem to matter (based solely on my
    experience or lack thereof).

    Where did you find documentation on this topic? The documentation I've
    found, to this point, regarding XData in VBA, is very limited, at best.

    Thanks for the info, in any case.
     
    TomD, Mar 2, 2005
    #8

  9. Very nice ! That opens new ways of selecting data !
    I'll give it a try !

    Arnaud
     
    Arnaud Lesauvage, Mar 3, 2005
    #9
  10. TomD

    fantum Guest

    I'm just basically confused as to why that would be.

    Since it seems that it doesn't work on the more primitive types I would guess that it was a design decision made a little late at autodesk and not back-ported.
    It is a bit thin on the ground. It's been a while but for filtering I probably worked mostly with the lisp docs.
     
    fantum, Mar 3, 2005
    #10
  11. TomD

    TomD Guest

    Thanks for the info. If I happen across anything of interest about XData on
    this project, I'll be sure to post.
     
    TomD, Mar 3, 2005
    #11
  12. TomD

    TomD Guest

    I'm finding the previous logic to be unreliable, at best............thought
    I'd warn you.

    Peter, we wish you were here! ;)
     
    TomD, Mar 8, 2005
    #12
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.