Group Codes and Normal Z

Discussion in 'AutoCAD' started by Patrick Weaver, Jul 20, 2004.

  1. Good morning!

    I'm looking for a way to create a selection set of objects with a Normal Z
    of -1. I thought of using ssget but I can't find the group code that I want.
    Is there one? Or maybe there's another tree I should be barking up?


    Thanks
     
    Patrick Weaver, Jul 20, 2004
    #1
  2. Patrick Weaver

    Doug Barr Guest

    210
     
    Doug Barr, Jul 20, 2004
    #2
  3. Patrick Weaver

    zeha Guest

    Patrick,

    You can try this

    (ssget '((-4 . "<AND")(-4 . "*,*,=")(10 0.0 0.0 -1.0)(-4 . "AND>")))

    cheers

    Harrie
     
    zeha, Jul 20, 2004
    #3
  4. Ahh...looking the the list. Are you sure it's not 230?
     
    Patrick Weaver, Jul 20, 2004
    #4
  5. I think this is finding the Z coordinate (it's filtering out everything in
    my test drawing - and I know there are bad objects in there). I looking for
    the "Normal Z". Open the chprop dialog and select a circle. At the bottom,
    you'll see Normal X, Y, and Z.

    Thanks
     
    Patrick Weaver, Jul 20, 2004
    #5
  6. Patrick Weaver

    Joe Burke Guest

    Patrick,

    Maybe another tree...

    ;; create a selection set of model space
    ;; objects with normal Z value equal to -1.0
    (defun NormalZ-1 ( / mspace ss )
    (setq mspace
    (vla-get-ModelSpace
    (vla-get-ActiveDocument
    (vlax-get-acad-object))))
    (setq ss (ssadd))
    (vlax-for item mspace
    (if
    (and
    (vlax-property-available-p item 'Normal)
    (= -1.0 (caddr (vlax-get item 'Normal)))
    )
    (ssadd (vlax-vla-object->ename item) ss)
    )
    )
    ss
    ) ;end

    Example:
    (setq sset (NormalZ-1))

    Joe Burke
     
    Joe Burke, Jul 21, 2004
    #6
  7. Patrick Weaver

    Doug Barr Guest

    ***This circle was drawn on the WCS.
    Select object: ((-1 . <Entity name: 1cffe10>) (0 . "CIRCLE") (330 . <Entity
    name: 1cffcf8>) (5 . "62") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (100 . "AcDbCircle") (10 2.0 0.0 0.0) (40 . 1.0) (210 0.0 0.0 1.0))

    ***This circle was drawn on a UCS at Y=180 to the WCS.
    Select object: ((-1 . <Entity name: 1cffe18>) (0 . "CIRCLE") (330 . <Entity
    name: 1cffcf8>) (5 . "63") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (100 . "AcDbCircle") (10 0.0 0.0 0.0) (40 . 1.0) (210 4.44089e-016 0.0
    -1.0))

    Maybe this ISN'T what you're after, but if it is, then you may use the following
    routine to select EVERYthing in the drawing that has a -1 Z value. Holler if
    it's not quite right.
    -doug

    (defun c:NZX ( ) ;Negative Z eXtrusion
    (setq nzs (ssadd))
    (setq a (ssget "X"))
    (setq b 0)
    (repeat (sslength a)
    (setq c (ssname a b))
    (setq d (entget c))
    (setq e (cadddr (assoc 210 d)))
    (if (equal e -1.0 0.000001)
    (setq nzs (ssadd c nzs))
    )
    (setq b (1+ b))
    )
    (setq nzslength (sslength nzs))
    (princ "\nThere are ")
    (princ nzslength)
    (princ " entities with -1 Z-extrusion in this drawing.")
    (princ "\nThat selection set is named !NZS.")
    (princ)
    )

    Apologies to Robert for my use of variable names that should be burned!
     
    Doug Barr, Jul 21, 2004
    #7
  8. Thankyou!Thankyou!Thankyou!Thankyou!

    This is perfect!
     
    Patrick Weaver, Jul 22, 2004
    #8
  9. Thanks for the clarification. I'll try that out.
     
    Patrick Weaver, Jul 22, 2004
    #9
  10. Thanks Joe!

    I tried this but I get the following error:

    Command: (setq sset(NormalZ-1))
    ; error: no function definition: VLAX-GET-ACAD-OBJECT

    Any ideas?
     
    Patrick Weaver, Jul 22, 2004
    #10
  11. Patrick Weaver

    Doug Barr Guest

    You're sooo welcome!
    <blubbering tears of joy that I can be of help to someone>
    -doug
     
    Doug Barr, Jul 22, 2004
    #11
  12. Patrick Weaver

    zeha Guest

    Patrick,
    first load
    (vl-load-com)
     
    zeha, Jul 22, 2004
    #12
  13. Patrick Weaver

    Joe Burke Guest

    Patrick,

    Zeha's advice applies. You need (vl-load-com) when running a version of ACAD prior to
    2004. Like this, if you want to try this method.

    (defun NormalZ-1 ( / mspace ss )
    (vl-load-com) ; insert here
    (setq mspace ...

    Sorry about the confusion.
    Joe Burke
     
    Joe Burke, Jul 22, 2004
    #13
  14. Thanks

    I knew I'd seen that error before, just couldn't remember why.
     
    Patrick Weaver, Jul 23, 2004
    #14
  15. Patrick Weaver

    BTO Guest

    hi,

    (ssget '((210 0 0 -1.0)))
    do nothing more

    Bruno Toniutti
     
    BTO, Jul 29, 2004
    #15
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.