Author Topic: Create multi-line Multilinien erstellen  (Read 2482 times)

0 Members and 1 Guest are viewing this topic.

Hugo

  • Bull Frog
  • Posts: 431
Create multi-line Multilinien erstellen
« on: January 18, 2011, 05:06:15 AM »
Hello

Have you a Lisp, here comes the following error message (see picture)
Can I please a look on the Lisp where is the problem.
Thanks

Hallo

Habe ihr ein Lisp, da kommt folgende Fehlermeldung (siehe Bild)
Kann mir bitte einer über das Lisp schauen wo der Fehler liegt.
Danke

Code: [Select]
;;--------------------------------------------------------------------------------
(defun c:du (/ curlay width sty)
  (kdub:AssertMultiLineStyleDefinitionsExist)
  (setq curlay (getvar "clayer"))
  (if (not (tblsearch "layer" "__E-Kabeltrasse"))
    (command "._-layer" "_make" "__E-Kabeltrasse" "_ltype" "continuous" "" "_color" "4" "" "")
    (setvar "clayer" "__E-Kabeltrasse")
  )
  (command "_-linetype" "_load" "*"
   "D:\\ACAD\\Linientypen\\KT.lin")
  (while (= "-LINETYPE" (getvar "CMDNAMES"))
    (command ""))
 
  ;;-----------------------------------
;;;  (setq width (getdist "\nSpecify width of Duct: "))
  (initget 1 "1 2 3 4 5 6")
  (if (and (setq sty (getkword "\nSpecify the MLineStyle [1 2 3 4 5 6]:"))
   (Kdub:Mlinestyle-Get sty)
      )
    (setvar 'cmlstyle sty) ;; (setvar 'CMLSTYLE <MlineStyleName>)
   
    (progn
      (alert "The chosen MLStyle is not avaliable")
      (exit))
 
  )
  ;;-----------------------------------
;;;(command "_mline" "_J" "_z" "_scale" width "")
     
  (command "_mline")
  (setvar "clayer" "curlay")
  (princ)
)
;;--------------------------------------------------------------------------------


;;--------------------------------------------------------------------------------
(defun Kdub:Mlinestyle-Get (Name / mlsty-DICT MLSty)
  (if (setq mlsty-DICT (dictsearch (Namedobjdict) "ACAD_MLINESTYLE"))
    (while (and mlsty-DICT
                (not (setq MLSty (if (and (assoc 3 mlsty-DICT) (= (strcase (cdr (assoc 3 mlsty-DICT))) (strcase Name)))
                                   (list (strcase Name) (cdr (cadr (member (assoc 3 mlsty-DICT) mlsty-DICT))))
                                 )
                     )
                )
           )
      (setq mlsty-DICT (cdr (member (assoc 3 mlsty-DICT) mlsty-DICT)))
    )
  )
  MLSty
)
;;--------------------------------------------------------------------------------
(defun massoc (key alist / x nlist)
  (foreach x alist
    (if (eq key (car x))
      (setq nlist (cons (cdr x) nlist))
    )
  )
  (reverse nlist)
)
;;--------------------------------------------------------------------------------


;;--------------------------------------------------------------------------------
(defun kdub:AssertMultiLineStyleDefinitionsExist
       (/  mlSty-DICT MultiLineStyle_lst StyleName)
  ;; kdub 20100807
  ;; Ensure definition of AcDbMlineStyles
  ;; Closed Opened First-open Last-open
  ;;-----------------------------------
  ;;-----------------------------------
  (setq mlSty-DICT-ent     (cdr (cadr (member '(3 . "ACAD_MLINESTYLE") (entget (namedobjdict)))))
        MultiLineStyle_lst (mapcar 'STRCASE (massoc 3 (entget mlSty-DICT-ent)))
  )
  ;|
  dxf 70 Flags (bit-coded):
 1 =Fill on
 2 = Display miters
 16 = Start square end (line) cap
 32 = Start inner arcs cap
 64 = Start round (outer arcs) cap
 256 = End square (line) cap
 512 = End inner arcs cap
 1024 = End round (outer arcs) cap
|;;;-----------------------------------
  (setq StyleName "1")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                              ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 0.25)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT100")
     '(49 . -0.25)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "2")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                                ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 0.50)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT200")
     '(49 . -0.50)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "3")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                              ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 .  0.75)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT300")
     '(49 . - 0.75)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "4")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                               ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 1.0)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT400")
     '(49 . -1.0)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "5")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                               ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 1.25)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT500")
     '(49 . -1.25)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "6")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                               ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 1.50)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT600")
     '(49 . -1.50)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (princ)
)


Aerdvark

  • Guest
Re: Create multi-line Multilinien erstellen
« Reply #1 on: January 18, 2011, 06:24:42 AM »
Hi Hugo,

Ich habe (glaube ich) der fehler entdeckt, versuch bitte mal ob es jetzt funktioniert.
Irgendwie bekomme ich die code nich aufs forum wie ich möchte aber es wird sich ausweisen.
Such nach:

Code: [Select]
;'(49 . - 0.75) ; This line gives the error

I believe I have found the error, please try.
Somehow the I cannot post the code with colored html as on other forums.
But you'll see my note.

Code: [Select]
;;--------------------------------------------------------------------------------
(defun c:du (/ curlay width sty)
  (kdub:AssertMultiLineStyleDefinitionsExist)
  (setq curlay (getvar "clayer"))
  (if (not (tblsearch "layer" "__E-Kabeltrasse"))
    (command "._-layer" "_make" "__E-Kabeltrasse" "_ltype" "continuous" "" "_color" "4" "" "")
    (setvar "clayer" "__E-Kabeltrasse")
  )
  (command "_-linetype" "_load" "*"
   "D:\\ACAD\\Linientypen\\KT.lin")
  (while (= "-LINETYPE" (getvar "CMDNAMES"))
    (command ""))
 
  ;;-----------------------------------
;;;  (setq width (getdist "\nSpecify width of Duct: "))
  (initget 1 "1 2 3 4 5 6")
  (if (and (setq sty (getkword "\nSpecify the MLineStyle [1 2 3 4 5 6]:"))
   (Kdub:Mlinestyle-Get sty)
      )
    (setvar 'cmlstyle sty) ;; (setvar 'CMLSTYLE <MlineStyleName>)
   
    (progn
      (alert "The chosen MLStyle is not avaliable")
      (exit))
 
  )
  ;;-----------------------------------
;;;(command "_mline" "_J" "_z" "_scale" width "")
     
  (command "_mline")
  (setvar "clayer" "curlay")
  (princ)
)
;;--------------------------------------------------------------------------------


;;--------------------------------------------------------------------------------
(defun Kdub:Mlinestyle-Get (Name / mlsty-DICT MLSty)
  (if (setq mlsty-DICT (dictsearch (Namedobjdict) "ACAD_MLINESTYLE"))
    (while (and mlsty-DICT
                (not (setq MLSty (if (and (assoc 3 mlsty-DICT) (= (strcase (cdr (assoc 3 mlsty-DICT))) (strcase Name)))
                                   (list (strcase Name) (cdr (cadr (member (assoc 3 mlsty-DICT) mlsty-DICT))))
                                 )
                     )
                )
           )
      (setq mlsty-DICT (cdr (member (assoc 3 mlsty-DICT) mlsty-DICT)))
    )
  )
  MLSty
)
;;--------------------------------------------------------------------------------
(defun massoc (key alist / x nlist)
  (foreach x alist
    (if (eq key (car x))
      (setq nlist (cons (cdr x) nlist))
    )
  )
  (reverse nlist)
)
;;--------------------------------------------------------------------------------


;;--------------------------------------------------------------------------------
(defun kdub:AssertMultiLineStyleDefinitionsExist
       (/  mlSty-DICT MultiLineStyle_lst StyleName)
  ;; kdub 20100807
  ;; Ensure definition of AcDbMlineStyles
  ;; Closed Opened First-open Last-open
  ;;-----------------------------------
  ;;-----------------------------------
  (setq mlSty-DICT-ent     (cdr (cadr (member '(3 . "ACAD_MLINESTYLE") (entget (namedobjdict)))))
        MultiLineStyle_lst (mapcar 'STRCASE (massoc 3 (entget mlSty-DICT-ent)))
  )
  ;|
  dxf 70 Flags (bit-coded):
 1 =Fill on
 2 = Display miters
 16 = Start square end (line) cap
 32 = Start inner arcs cap
 64 = Start round (outer arcs) cap
 256 = End square (line) cap
 512 = End inner arcs cap
 1024 = End round (outer arcs) cap
|;;;-----------------------------------
  (setq StyleName "1")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                              ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 0.25)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT100")
     '(49 . -0.25)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "2")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                                ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 0.50)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT200")
     '(49 . -0.50)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "3")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                              ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 .  0.75)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT300")
     ;'(49 . - 0.75) ; This line gives the error
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "4")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                               ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 1.0)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT400")
     '(49 . -1.0)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "5")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                               ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 1.25)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT500")
     '(49 . -1.25)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (setq StyleName "6")
  (if (not (member (strcase StyleName) MultiLineStyle_lst))
    (dictadd mlSty-DICT-ent
             StyleName
             (entmakex (list '(0 . "MLINESTYLE")
                             '(100 . "AcDbMlineStyle")
                             (cons 2 StyleName)
                             '(70 . 272)                               ; End flag
                             '(3 . "")                                ; StyleDescription
                             '(62 . 256)                              ; fill color
                             '(51 . 1.5708)                           ; start angle
                             '(52 . 1.5708)                           ; end angle
                             '(71 . 3)                                ; qty elements
                                                                      ;
                             '(49 . 1.50)                              ; element offset
                             '(62 . 256)
                             '(6 . "BYLAYER")                         ; Element Linetype
                             '(49 . 0.0)
                             '(62 . 131)
                             '(6 . "KT600")
     '(49 . -1.50)
     '(62 . 256)
     '(6 . "BYLAYER")
                       )
             )
    )
  )
  ;;-----------------------------------
  (princ)
)


Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Create multi-line Multilinien erstellen
« Reply #2 on: January 18, 2011, 06:46:05 AM »
With all those 'kdub' references I'm sure Kerry will be around to lend a hand  :-)

efernal

  • Bull Frog
  • Posts: 206
Re: Create multi-line Multilinien erstellen
« Reply #3 on: January 18, 2011, 07:34:11 AM »
change
(SETVAR "clayer" "curlay")
for
(SETVAR "clayer" curlay)

e.fernal
e.fernal

Hugo

  • Bull Frog
  • Posts: 431
Re: Create multi-line Multilinien erstellen
« Reply #4 on: January 18, 2011, 07:42:06 AM »
@ Aerdvark

Thanks for the true error

Danke das wahr der Fehler  :-D

nivuahc

  • Guest
Re: Create multi-line Multilinien erstellen
« Reply #5 on: January 18, 2011, 08:03:36 AM »
note to self: brush up on your German