Author Topic: layer change routine wanted  (Read 4428 times)

0 Members and 1 Guest are viewing this topic.

Atwist

  • Guest
layer change routine wanted
« on: August 18, 2012, 06:10:43 AM »
Hello,

Does anyone have a tool to items from layer A to layer B to change.
For example, a lisp with a dcl 2 lists where you have 1 choice list and target list.

Thank you
« Last Edit: August 18, 2012, 08:54:25 AM by CAB »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: layer chance
« Reply #1 on: August 18, 2012, 06:42:31 AM »
LAYMRG / LAYTRANS ?

Atwist

  • Guest
Re: layer chance
« Reply #2 on: August 18, 2012, 07:37:30 AM »

Thank you Lee,

 I knew that but I really wanted to make something become easier.
 I have somewhere a lisp with DCL found that this was possible, but now I can not remember who and where I found it.
 And the empty layer wast then deleted








mkweaver

  • Bull Frog
  • Posts: 352
Re: layer chance
« Reply #3 on: August 20, 2012, 09:20:42 AM »

Thank you Lee,

 I knew that but I really wanted to make something become easier.
 I have somewhere a lisp with DCL found that this was possible, but now I can not remember who and where I found it.
 And the empty layer wast then deleted

If you are changing all objects from one layer to another then laymrg will do what you want, and it doesn't get much easier than that.

If you are only changing a selection of objects then use the properties palette.  Again, it doesn't get much easier.

Unless I'm not understanding what you want, and that could be the case.

Mike

Atwist

  • Guest
Re: layer change routine wanted
« Reply #4 on: August 20, 2012, 11:23:08 AM »
Yes you are right, I have a word with "Laymrg" played and that also works well.
Thank you for your wise counsel.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #5 on: August 20, 2012, 12:59:50 PM »
Hello!

Itīs little easier if I choise a layer in  listbox I want change. At the same time it isolate me picked layer and and I can choice a layer from another listbox I want to move. And than I cklick on move button. to run changing. I have done it with a openDCL-form so itīs much comfortably.
Is that what you need?

Recall Dirk

Atwist

  • Guest
Re: layer change routine wanted
« Reply #6 on: August 21, 2012, 03:05:53 AM »
Hello Dirk,

That's actually what I'm looking. :lol:

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #7 on: August 21, 2012, 04:41:48 AM »
Hello again!

You have to do 3 things before you run routine
1) Install OpenDCL runtime from www.opendcl.com
2) In file laylist.txt can youself define your Standard layer which you want move to
3) put in searchpath in your support-tab on optionfield there odcl is, so Autocad can find odcl-file

run with "laytool"

Code: [Select]
; <<< Help Utilities >>>

(defun getLayer (/ laynam lay laylist)
  (setq laynam (tblnext "layer" T))
  (while laynam
    (setq lay (cdr (assoc 2 laynam)))
    (setq laylist (vl-sort (append laylist (list lay)) '<))
    (setq laynam (tblnext "layer"))
    )
  laylist
  )

(defun standard ( / file OpenFile Line Content)
  (if (setq file (findfile "c:\\Your searchpath there Laylist is\\LayerList.txt"))
    (progn
      (setq OpenFile (open file "r"))
      (while
        (setq Line (read-line OpenFile))
        (if (not (wcmatch line ""))
          (setq Content (append Content (list line)))
        )
      )
      (close OpenFile)
    ) 
  )
  Content
  )

; <<< OpenDCL Event Handlers >>>

(defun c:LayTool ()
  (command "OPENDCL")
  (dcl_Project_Load "LayerTool" T)
  (dcl_Form_Show LayerTool_PalLayer)
  (princ)
  )
 
(defun c:LayerTool_PalLayer_OnInitialize (/)
  (dcl_ListBox_Clear LayerTool_PalLayer_ListboxLayer)
  (DCL_LISTBOX_ADDLIST LayerTool_PalLayer_ListboxLayer (getLayer))
  (DCL_LISTBOX_ADDLIST LayerTool_PalLayer_ListboxLayerStandard (standard))
  )

(defun c:LayerTool_PalLayer_ListBoxLayer_OnSelChanged (ssL txt /)
  (setq sS "")
  (if (setq iL (dcl_ListBox_GetCurSel LayerTool_PalLayer_ListboxLayer))
    (setq sL (dcl_ListBox_GetItemText LayerTool_PalLayer_ListBoxLayer iL))
    )
  (if (setq iS  (dcl_ListBox_GetCurSel LayerTool_PalLayer_ListBoxLayerStandard))
    (setq sS (dcl_ListBox_GetItemText LayerTool_PalLayer_ListBoxLayerStandard iS))
    )
  (setvar "CLAYER" sL)
  (command "layer" "off" "*" "y" "") (princ)
  (command "layer" "on" sL "" ) (princ)
  (princ (strcat sL " "))
  (princ (strcat "-> " sS))
  (princ)
  )

(defun c:LayerTool_PalLayer_cmdMove_OnClicked (/)
  (if (setq AWS (ssget "X" (list (cons 8 sL))))
    (progn
      (setq I -1)
      (repeat (sslength AWS)
        (setq OBJ (ssname AWS(setq I (1+ I))))
        (setq DATA(entget OBJ))
        (entmod (subst (cons 8 sS)
                       (assoc 8 (entget OBJ))
                       (entget OBJ)
                       )
                )
        )
      )
    )
  (princ "\nok")
  (princ)
  )

(defun c:LayerTool_PalLayer_cmdLayerOn_OnClicked (/)
  (command "layer" "on" "*" "" ) (princ)
  )

Thanks to Owen and irned, you give me very good ideas

Recall me if you have trouble to install.
Otherwis have fun!

Dirk


 












« Last Edit: August 21, 2012, 04:58:10 AM by cadplayer »

Atwist

  • Guest
Re: layer change routine wanted
« Reply #8 on: August 21, 2012, 05:19:55 AM »
Hello Dirk,

 I think the actions done like you described, but laytool can not find my layerlist.txt.
 have c:\\Your searchpath there Laylist is\\LayerList.txt changed into C:\Users\Andreas\AppData\Roaming\Autodesk\AutoCAD 2008\R17.1\enu\Support\\layerList.txt

 

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #9 on: August 21, 2012, 05:43:41 AM »
Hi Andi!

instead paste this
C:\\Users\\Andreas\\AppData\\Roaming\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\layerList.txt

Atwist

  • Guest
Re: layer change routine wanted
« Reply #10 on: August 21, 2012, 06:11:57 AM »
Dirk

Yes it does work I saw that I was a "\" was forgotten thanks.
 But now I have another problem.
 If I use the "drawing layer" click and then "move to layer" then nothing happens.
 Get in my command bar

 "Current layer:" Bemating "
 Enter an option
 [? / Make / Set / New / ON / OFF / Color / Ltype / LWeight / Material / Plot / Freeze / Thaw / Lock / Unlock
 / State]: on
 Enter name list of layer (s) to turn on: Dimensioning Enter an option
 [? / Make / Set / New / ON / OFF / Color / Ltype / LWeight / Material / Plot / Freeze / Thaw / Lock / Unlock
 / State]:
 Command: Bemating -> Aandr.-maat


But everything remains on the old layer are
« Last Edit: August 21, 2012, 06:22:13 AM by Atwist »

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #11 on: August 21, 2012, 06:43:17 AM »
I work with english version of Autocad, overwise you have to change

(command "layer" -> (command "_layer"

 (command "_layer" "_off" "*" "_y" "") (princ)
  (command "_layer" "_on" sL "" ) (princ)




You have to mark in both listbox

1)

listbox "Drawing layer" ... select

2)

listbox "Move to" ...

You can see in command rad layer1 -> layer2

3) Push button move
thats all
« Last Edit: August 21, 2012, 06:59:56 AM by cadplayer »

Atwist

  • Guest
Re: layer change routine wanted
« Reply #12 on: August 21, 2012, 06:51:48 AM »
That makes everything clear, only there is no button move :oops:

Atwist

  • Guest
Re: layer change routine wanted
« Reply #13 on: August 21, 2012, 07:14:44 AM »
I have created the buttons and now it works fine. :kewl:

 Thank you for this tool. :-D

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #14 on: August 21, 2012, 07:21:42 AM »
Yes I have seen listbox could be smaller so it also seems move button, you can change very comfortably with OpenDCL editor...