Looking for LSP to look for LineTypes

Discussion in 'AutoCAD' started by Mr. B, May 15, 2007.

  1. Mr. B

    Mr. B Guest

    Acad 2005

    I do Electrical Design for buildings. Architects usually give me their Acad
    drawings for my backgrounds (Xref's).

    Many times their DWG files entities are not broken down in separate layers for
    things such as Existing Walls, New Walls, Existing Millwork vs. New Millwork,
    Demo, etc.

    They may have a layer (say A-Walls) where they show both Existing walls and
    Demolition of existing walls on the Same layer. But they use different
    LineTypes and Colours to show the difference.

    This drives me nutz as I can't (on my side) control the LineType and Colours
    for my backgrounds. And since I work with many Architects, me trying to
    conform to their layer colours is just not an option.

    The reason that they do things this way is that they don't really concern
    themselves with how others use their drawings (just so long as it works for
    them).

    What I'm looking for is a Lisp routine where I can select all entities on a
    choosen layer, look for a specific Line type (ususally Hidden or Hidden2).
    And then be able to change those with that criteria to a unique layer.

    If anyone has such an animal, or something close, I'd appreciate a copy. I've
    some Lisp knowledge, but I'm having one heck of a time trying to weed out what
    I want (my Lisp is in a mess right now too as a result of many variations) :(

    Regards,

    BruceF
     
    Mr. B, May 15, 2007
    #1
  2. The native FILTER command followed by the CHANGE command will do that.
     
    Michael Bulatovich, May 16, 2007
    #2
  3. Mr. B

    Mr. B Guest

    Argh... you are correct!!! I've never used the Filter command before (thus my
    ignorance about it).

    I'll modify my Lisp routine to include the Filter command and see what comes
    up.

    Thanks for the direction!

    BruceF
     
    Mr. B, May 16, 2007
    #3
  4. AutoCAD's best kept secret, next to CAL.
     
    Michael Bulatovich, May 16, 2007
    #4
  5. Mr. B

    Mr. B Guest

    Actually, it's because I've had a lot of pre 'Filter' routines that did what
    Filter does now. So I've never needed to use it :)

    BruceF
     
    Mr. B, May 16, 2007
    #5
  6. I don't know when they created that command, but I think it was before r13.
     
    Michael Bulatovich, May 16, 2007
    #6
  7. Mr. B

    Dr Fleau Guest

    Sorry for the late post, but here is a routine I use to transfer entities
    (not linetypes) from clients to our own standards. Copy paste save to your
    heart's desire.
    Oh yeah, it's in french, but that shouldn't be a problem for most people
    here.
    *click click tap tap tap tap click*
    ;;; Pierre Marcotte
    ;;; 26 mai 2004
    ;;;
    ;;; Ce petit programme est sujet à toutes les lois
    ;;; et règlements municipaux en vigueur dans votre
    ;;; région.
    ;;; Une infraction à ces règles conduira l'utilisateur
    ;;; fautif directement dans les flammes de l'enfer.
    ;;; Votre seule chance de salut consiste à vous lever
    ;;; debout immédiatement, lever les bras vers les néons
    ;;; flicotants, et implorer le triumvirat céleste des
    ;;; Dieux d'AutoCAD, SPLAÏNE, EX-REFF et REDJEN.
    ;;; Récitez maintenant la formule magique transmise
    ;;; de génération en génération depuis la désormais
    ;;; mythique et légendaire version 1.1 :
    ;;; "Je suis un ver. Je regrette. Je ne suis rien."

    (DEFUN c:laychange
    (/ dims leaders texts mtexts
    hatchs traces cnt1 cnt2 cnt3
    cnt4 cnt5 cnt6 each
    )
    (SETQ dims (SSGET "X" '((0 . "DIMENSION"))))
    (SETQ leaders (SSGET "X" '((0 . "LEADER"))))
    (SETQ texts (SSGET "X" '((0 . "TEXT"))))
    (SETQ mtexts (SSGET "X" '((0 . "MTEXT"))))
    (SETQ hatchs (SSGET "X" '((0 . "HATCH"))))
    (SETQ traces (SSGET "X" '((0 . "TRACE"))))
    (IF (NOT (TBLSEARCH "Layer" "Cote"))
    (COMMAND "-layer" "m" "Cote" "c" "cyan" "" "")
    )
    (IF (NOT (TBLSEARCH "Layer" "Hachure"))
    (COMMAND "-layer" "m" "Hachure" "c" "8" "" "")
    )
    (IF (NOT (TBLSEARCH "Layer" "Texte"))
    (COMMAND "-layer" "m" "Texte" "c" "yellow" "" "")
    )
    ;; Amorce un compteur
    ;;; DIMENSION
    (SETQ cnt1 0)
    ;; Démarre une boucle
    (IF (NOT (= nil dims))
    (REPEAT (SSLENGTH dims)
    ;; Donne un nom aux objets DIMENSION
    (SETQ each (ENTGET (SSNAME dims cnt1)))
    ;; Change sa couche
    (SETQ each
    (SUBST (CONS 8 "Cote")
    (ASSOC 8 each)
    each
    )
    )
    (ENTMOD each)
    ;; Itère le compteur
    (SETQ cnt1 (+ cnt1 1))
    ;; Recommence pour chaque entité de l'ancienne
    ;; couche
    ) ;_end REPEAT
    ) ;_end IF DIMS
    ;;; LEADER
    (SETQ cnt2 0)
    (IF (NOT (= nil leaders))
    (REPEAT (SSLENGTH leaders)
    ;; Donne un nom aux objets LEADER
    (SETQ each (ENTGET (SSNAME leaders cnt2)))
    ;; Change sa couche
    (SETQ each
    (SUBST (CONS 8 "Cote")
    (ASSOC 8 each)
    each
    )
    )
    (ENTMOD each)
    ;; Itère le compteur
    (SETQ cnt2 (+ cnt2 1))
    ;; Recommence pour chaque entité de l'ancienne
    ;; couche
    )
    ) ;_end IF LEADERS
    ;;; TEXT
    (SETQ cnt3 0)
    (IF (NOT (= nil texts))
    (REPEAT (SSLENGTH texts)
    ;; Donne un nom aux objets TEXT
    (SETQ each (ENTGET (SSNAME texts cnt3)))
    ;; Change sa couche
    (SETQ each
    (SUBST (CONS 8 "Texte")
    (ASSOC 8 each)
    each
    )
    )
    (ENTMOD each)
    ;; Itère le compteur
    (SETQ cnt3 (+ cnt3 1))
    ;; Recommence pour chaque entité de l'ancienne
    ;; couche
    )
    ) ;_end IF TEXTS
    ;;; MTEXT
    (SETQ cnt4 0)
    (IF (NOT (= nil mtexts))
    (REPEAT (SSLENGTH mtexts)
    ;; Donne un nom aux objets MTEXT
    (SETQ each (ENTGET (SSNAME mtexts cnt4)))
    ;; Change sa couche
    (SETQ each
    (SUBST (CONS 8 "Texte")
    (ASSOC 8 each)
    each
    )
    )
    (ENTMOD each)
    ;; Itère le compteur
    (SETQ cnt4 (+ cnt4 1))
    ;; Recommence pour chaque entité de l'ancienne
    ;; couche
    )
    ) ;_end IF MTEXTS
    ;;; HATCH
    (SETQ cnt5 0)
    ;; Démarre une boucle
    (IF (NOT (= nil hatchs))
    (REPEAT (SSLENGTH hatchs)
    ;; Donne un nom aux objets DIMENSION
    (SETQ each (ENTGET (SSNAME hatchs cnt5)))
    ;; Change sa couche
    (SETQ each
    (SUBST (CONS 8 "Cote")
    (ASSOC 8 each)
    each
    )
    )
    (ENTMOD each)
    ;; Itère le compteur
    (SETQ cnt5 (+ cnt5 1))
    ;; Recommence pour chaque entité de l'ancienne
    ;; couche
    ) ;_end REPEAT
    ) ;_end IF HATCH
    ;;; TRACE
    (SETQ cnt6 0)
    ;; Démarre une boucle
    (IF (NOT (= nil traces))
    (REPEAT (SSLENGTH traces)
    ;; Donne un nom aux objets TRACE
    (SETQ each (ENTGET (SSNAME traces cnt6)))
    ;; Change sa couche
    (SETQ each
    (SUBST (CONS 8 "Hachure")
    (ASSOC 8 each)
    each
    )
    )
    (ENTMOD each)
    ;; Itère le compteur
    (SETQ cnt6 (+ cnt6 1))
    ;; Recommence pour chaque entité de l'ancienne
    ;; couche
    ) ;_end REPEAT
    ) ;_end IF TRACES
    (COMMAND "_.regen")
    ;; Messages de fin
    (IF (NOT (= cnt1 nil))
    (SETQ mes1 (STRCAT "\n ---> "
    (ITOA cnt1)
    " DIMENSION changés de couche."
    )
    )
    (SETQ mes1 "\n Pas de DIMENSION trouvés.")
    ) ;_end IF

    (IF (NOT (= cnt2 nil))
    (SETQ mes2 (STRCAT "\n ---> "
    (ITOA cnt2)
    " LEADER changés de couche."
    )
    )
    (SETQ mes2 "\n Pas de LEADER trouvés.")
    ) ;_end IF

    (IF (NOT (= cnt3 nil))
    (SETQ mes3 (STRCAT "\n ---> "
    (ITOA cnt3)
    " TEXT changés de couche."
    )
    )
    (SETQ mes3 "\n Pas de TEXT trouvés.")
    ) ;_end IF

    (IF (NOT (= cnt4 nil))
    (SETQ mes4 (STRCAT "\n ---> "
    (ITOA cnt4)
    " MTEXT changés de couche."
    )
    )
    (SETQ mes4 "\n Pas de MTEXT trouvés.")
    ) ;_end IF

    (IF (NOT (= cnt5 nil))
    (SETQ mes5 (STRCAT "\n ---> "
    (ITOA cnt5)
    " HATCH changés de couche."
    )
    )
    (SETQ mes5 "\n Pas de HATCH trouvés.")
    ) ;_end IF
    (IF (NOT (= cnt6 nil))
    (SETQ mes6 (STRCAT "\n ---> "
    (ITOA cnt5)
    " TRACE changés de couche."
    )
    )
    (SETQ mes6 "\n Pas de TRACE trouvés.")
    )
    (ALERT (STRCAT mes1 mes2 mes3 mes4 mes5 mes6))
    (PRINC)
    ) ;_end DEFUN

    *send*
     
    Dr Fleau, Jun 7, 2007
    #7
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.