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

0 Members and 1 Guest are viewing this topic.

Atwist

  • Guest
Re: layer change routine wanted
« Reply #15 on: August 21, 2012, 07:28:45 AM »
Indeed I have the format changed slightly.

 It's a very nice tool

 Thanks a lot.

Sam

  • Bull Frog
  • Posts: 201
Re: layer change routine wanted
« Reply #16 on: August 21, 2012, 07:55:41 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
dear sir,
scaling the tool pallet move button not show
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #17 on: August 21, 2012, 08:17:56 AM »
Here I have change size of palettes...

Sam

  • Bull Frog
  • Posts: 201
Re: layer change routine wanted
« Reply #18 on: August 21, 2012, 08:40:41 AM »
Here I have change size of palettes...

dear sir,
thx
1) can u add layoff, layon, layfrz, etc... button
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #19 on: August 21, 2012, 09:55:49 AM »
All layer on means "layon"
button freeze and layoff are pasted


owenwengerd

  • Bull Frog
  • Posts: 451
Re: layer change routine wanted
« Reply #20 on: August 21, 2012, 11:01:23 AM »
Yes I have seen listbox could be smaller so it also seems move button, you can change very comfortably with OpenDCL editor...

Better would be to make all the controls resize automatically as the form size changes. You can use the property wizard in the OpenDCL editor to make it easy. Add a horizontal splitter between the two listboxes, then position the list boxes relative to the splitter.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: layer change routine wanted
« Reply #21 on: August 22, 2012, 02:15:01 AM »
Thanks Owen - very nice, more attractive!