TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: FengK on May 05, 2006, 02:26:42 AM

Title: why is selectionset name case-sensitive?
Post by: FengK on May 05, 2006, 02:26:42 AM
Seems for every collection in AutoCAD: layer, block, registered appilcations, view, ucs, etc., the name is case-insensitive, but why is selectionset different?  I could not think of any good reason.  Thank you.
Title: Re: why is selectionset name case-sensitive?
Post by: Kerry on May 05, 2006, 02:29:27 AM
Can you show an example Kelie ?
Title: Re: why is selectionset name case-sensitive?
Post by: FengK on May 05, 2006, 03:48:49 AM
Thanks Kerry.

Try testing something like this?

Code: [Select]
(setq colSS (vla-get-selectionsets
      (vla-get-activedocument
(vlax-get-acad-object)
      )
    )
)
(setq objSS1 (vla-add colSS "ssA"))
(setq objSS2 (vla-add colSS "ssa"))

(equal objSS1 objSS2) ; -> returns nil.

What did I miss?  I noticed this long time ago.  I just made sure always using uppercase.

<code tags added>
Title: Re: why is selectionset name case-sensitive?
Post by: Kerry on May 05, 2006, 04:24:14 AM
You're correct, using ActiveX ..

The best solution is  to use all upper or all lower, as you are doing.

There are a couple of things to watch with string case Using ActiveX ..

Have a try with this one  .. it's a real trap, cause the LayerObjects are reported, but the Layers don't exist in the database.
Code: [Select]
(setq collLayers (vla-get-layers
         (vla-get-activedocument
      (vlax-get-acad-object)
         )
       )
)
(vla-get-count collLayers)
;;-> 1
(setq objLAY1 (vla-add collLayers "LAY1"))
;;-> #<VLA-OBJECT IAcadLayer2 07d391a4>
(setq obLAY2 (vla-add collLayers "lay1"))
;;-> #<VLA-OBJECT IAcadLayer2 07d39134>
(setq obLAY3 (vla-add collLayers "lAy1"))
;;-> #<VLA-OBJECT IAcadLayer2 07d395e4>
(setq obLAY4 (vla-add collLayers "lAY1"))
;;-> #<VLA-OBJECT IAcadLayer2 07d39594>
(vla-get-count collLayers)
;;-> 2

<repaired result of fat fingers>
Title: Re: why is selectionset name case-sensitive?
Post by: Kerry on May 05, 2006, 05:08:46 AM
Just to clarify that :

This is the result.
Code: [Select]
(vla-get-Name objLAY1)
;;-> "LAY1"

(vla-get-Name obLAY2)
;;-> "LAY1"

(vla-get-Name obLAY3)
;;-> "LAY1"

(vla-get-Name obLAY4)
;;-> "LAY1"

I'm not going to try to second guess the designers regarding the logic behind the inconsistancy.