Author Topic: Need help with DCL File  (Read 3551 times)

0 Members and 1 Guest are viewing this topic.

Dave M

  • Newt
  • Posts: 196
Need help with DCL File
« on: February 18, 2014, 02:49:46 PM »
I have been using this routine to put xrefs on a specific layer for years.  It has a problem though, the dialogue box doesn't work as expected.  I don't have the skill set to fix it.  There's not many lines of code, so I was hoping one of you "brainiacs" out there would be willing to fix it for me.
 
Thanks for looking!
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Need help with DCL File
« Reply #1 on: February 18, 2014, 03:17:40 PM »
Try the attached...
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Need help with DCL File
« Reply #2 on: February 18, 2014, 03:43:54 PM »
Really not the place for this thread....

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Need help with DCL File
« Reply #3 on: February 18, 2014, 03:44:33 PM »
Really not the place for this thread....
:?
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Need help with DCL File
« Reply #4 on: February 18, 2014, 03:49:07 PM »
On a side note, I could never get the mnemonic option to work in DCL

Dave M

  • Newt
  • Posts: 196
Re: Need help with DCL File
« Reply #5 on: February 18, 2014, 03:54:23 PM »
Really not the place for this thread....

Can you tell me where the appropriate place is so I know for next time?
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Need help with DCL File
« Reply #6 on: February 18, 2014, 03:59:56 PM »
Really not the place for this thread....
I see now.  The OP posted in "SHOW YOUR STUFF" when it should've been in AutoLISP (Vanilla / Visual).
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Need help with DCL File
« Reply #7 on: February 18, 2014, 04:52:28 PM »
Modified version with No DCL
Code - Auto/Visual Lisp: [Select]
  1. ;;;written by  Michael P. Fowler
  2. ;;;09/16/98
  3. ;;;written for Rainer Will
  4. ;;;written in R14
  5. ;;;put xrefs on layers that are equal to the xref name
  6.  
  7. ;;;  Modified by CAB 02/18/2014
  8.  
  9. (defun c:xlayer (/ lname ent elist blist xass xcat xlname xlay)
  10.   (alert (strcat "This will change the layer of the selected XREF"
  11.                  "\nto a layer named 0_xx \nwhere xx is the name of the xref" )
  12.   )
  13.  
  14.   (if (and
  15.         (setq ent (car (entsel "Pick xref to change layer name to match xref name: ")))
  16.         (setq xass (cdr (assoc 2 (setq elist (entget ent)))))
  17.         (setq blist (entget (tblobjname "BLOCK" xass)))
  18.         (= 4 (logand (cdr (assoc 70 blist)) 4))
  19.   )
  20.     (progn
  21.       (setq lname (getvar "clayer")
  22.             xlay  (cdr (assoc 8 elist))
  23.             xcat  (strcat "0_" xass)
  24.       )
  25.       (command ".layer" "m" xcat "")
  26.       (setq xlname (getvar "clayer"))
  27.       (command ".layer" "u" xlay "")
  28.       (command "change" ent "" "P" "la" xlname "")
  29.       (command ".layer" "lo" xcat "")
  30.       (setvar "clayer" lname)
  31.       (princ (strcat "\nThe xref---" xass "---is now on the---" xcat "---layer")
  32.       )
  33.  
  34.     )
  35.     (princ "\nUser Quit or picked non-Xref object....")
  36.   )
  37.   (princ)
  38. )
  39.  
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Dave M

  • Newt
  • Posts: 196
Re: Need help with DCL File
« Reply #8 on: February 18, 2014, 05:59:58 PM »
Thanks M@yhem for fixing the DCL, it works great.  Thanks Charles for the no-DCL version.  I think I like it best!
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Need help with DCL File
« Reply #9 on: February 18, 2014, 06:18:36 PM »
Some icing for the selection:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:xlay ( / xl xn xr )
  2.     (while
  3.         (progn (setvar 'errno 0) (setq xr (car (entsel "\nSelect xref: ")))
  4.             (cond
  5.                 (   (= 7 (getvar 'errno))
  6.                     (princ "\nMissed, try again.")
  7.                 )
  8.                 (   (null xr) nil)
  9.                 (   (or (/= "INSERT" (cdr (assoc 0 (setq xr (entget xr)))))
  10.                         (zerop (logand 4 (cdr (assoc 70 (tblsearch "block" (cdr (assoc 2 xr)))))))
  11.                     )
  12.                     (princ "\nSelected object is not an xref.")
  13.                 )
  14.                 (   t
  15.                     (lock-unlock-layer (cdr (setq xl (assoc 8 xr))) nil)
  16.                     (entmod (subst (cons 8 (setq xn (strcat "0_" (cdr (assoc 2 xr))))) xl xr))
  17.                     (lock-unlock-layer xn t)
  18.                     nil
  19.                 )
  20.             )
  21.         )
  22.     )
  23.     (princ)
  24. )
  25. (defun lock-unlock-layer ( lay lck / dxf enx )
  26.     (if (setq enx (tblobjname "layer" lay))
  27.         (progn
  28.             (setq enx (entget enx)
  29.                   dxf (assoc 70 enx)
  30.             )
  31.             (entmod (subst (cons 70 (boole (if lck 7 4) 4 (cdr dxf))) dxf enx))
  32.         )
  33.     )
  34. )

Dave M

  • Newt
  • Posts: 196
Re: Need help with DCL File
« Reply #10 on: February 18, 2014, 07:58:56 PM »
Thanks Lee! I always appreciate your input!
Dave
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

Bhull1985

  • Guest
Re: Need help with DCL File
« Reply #11 on: February 19, 2014, 07:40:50 AM »
Some icing for the selection:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:xlay ( / xl xn xr )
  2.     (while
  3.         (progn (setvar 'errno 0) (setq xr (car (entsel "\nSelect xref: ")))
  4.             (cond
  5.                 (   (= 7 (getvar 'errno))
  6.                     (princ "\nMissed, try again.")
  7.                 )
  8.                 (   (null xr) nil)
  9.                 (   (or (/= "INSERT" (cdr (assoc 0 (setq xr (entget xr)))))
  10.                         (zerop (logand 4 (cdr (assoc 70 (tblsearch "block" (cdr (assoc 2 xr)))))))
  11.                     )
  12.                     (princ "\nSelected object is not an xref.")
  13.                 )
  14.                 (   t
  15.                     (lock-unlock-layer (cdr (setq xl (assoc 8 xr))) nil)
  16.                     (entmod (subst (cons 8 (setq xn (strcat "0_" (cdr (assoc 2 xr))))) xl xr))
  17.                     (lock-unlock-layer xn t)
  18.                     nil
  19.                 )
  20.             )
  21.         )
  22.     )
  23.     (princ)
  24. )
  25. (defun lock-unlock-layer ( lay lck / dxf enx )
  26.     (if (setq enx (tblobjname "layer" lay))
  27.         (progn
  28.             (setq enx (entget enx)
  29.                   dxf (assoc 70 enx)
  30.             )
  31.             (entmod (subst (cons 70 (boole (if lck 7 4) 4 (cdr dxf))) dxf enx))
  32.         )
  33.     )
  34. )

Found another one just like the previous Lee :D
                (   (null xr) nil)

I see how you're using it, with your description and the alternate routine, interesting! I think I may have to incorporate this as well because it seems as if it'd be the proper way to handle a user right clicking through a routine.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Need help with DCL File
« Reply #12 on: February 19, 2014, 06:21:52 PM »
Thanks Lee! I always appreciate your input!
Dave

You're welcome Dave!  :-)

I think I may have to incorporate this as well because it seems as if it'd be the proper way to handle a user right clicking through a routine.

There are many ways to skin a cat in AutoLISP  ;-)