"Arnaud Lesauvage" wrote in message
news:4225719b$1_2@newsprd01...
> TomD wrote:
>> 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. ;)
>
> 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, ...)
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