Rekomendowane odpowiedzi

Opublikowano

Serdecznie proszę o wsparcie, znalazłem lispa wstawiającego blok w zadanej odległości na krzywej. Wszystko działa na zwcadzie bez zainstalowanego ZWTraffic. W zwcadzie z tą nakładka dostaję błąd po podaniu odległości :

Distance to Block Insertion: 8.16
ZWTrafficUpdate-evaluate:*error*: niepoprawny typ argumentu: consp: nil

 

Cytuj

 

;| PUT.LSP ver. 2.0 (c) 2005 Tee Square Graphics
    Improved version of PUT.LSP originally published in 1998. This
    version avoids the use of the native MEASURE command, using instead
    the curve functions of Visual LISP (VLISP).
    
    PUT places a single block insertion a user-specified distance from
    the selected end of a non-closed AutoCAD object (i.e., ARC, LINE, 
    POLYLINE, LWPOLYLINE, SPLINE).
|;

(defun C:PUT (/ os ce bm blk ent obj ppt dst ept ref len ipt par slp ang)
  (command "_.undo" "_be")
  (setq os (getvar "osmode")
        ce (getvar "cmdecho")
        bm (getvar "blipmode")
        blk ""
  );;setq
  (if (not bk)(setq bk ""))
  (setvar "osmode" 0)
  (setvar "cmdecho" 0)
  (setvar "blipmode" 0)
  (while (not (setq ent (entsel "\nSelect object near reference end: "))))
  (while
    (and
      (not (tblsearch "block" blk))
      (not (findfile (strcat blk ".dwg")))
    );;and
    (setq blk (getstring (strcat "\nBlock to use <" bk ">: ")))
    (if (> blk "")(setq bk blk)(setq blk bk))      
  );;while
  (setq obj (car ent)
        ppt (osnap (cadr ent) "nea")
        dst (getdist "\nDistance to Block Insertion: ")
        ept (vlax-curve-getEndPoint obj)
        ref (vlax-curve-getDistAtPoint obj ppt)
        len (vlax-curve-getDistAtPoint obj ept)
  );;setq
  (if (> ref (/ len 2.0))
    (setq dst (- len dst))
  );;setq
  (setq ipt (vlax-curve-getPointAtDist obj dst)
        par (vlax-curve-getParamAtPoint obj ipt)
        slp (vlax-curve-getFirstDeriv obj par)
        ang (atan (/ (cadr slp)(car slp)))
  );;setq
  (entmake
    (list
      '(0 . "INSERT")
      (cons 2 blk)
      (cons 10 ipt)
      (cons 50 ang)
    );;list
  );;entmake
  (setvar "osmode" os)
  (setvar "cmdecho" ce)
  (setvar "blipmode" bm)
  (command "_.undo" "_e")
  (princ)
)
(alert
  (strcat
    "PUT.LSP ver. 2.0 (c) 2005 Tee Square Graphics"
    "\n\n            Type PUT to begin."
  )
)

 

 

Opublikowano

Przyznaję, pierwsza diagnoza była błędna, zmylił mnie test na zw2019 na którym nie mam ZWTraffic.  Tam lisp chodzi dobrze. Na zw2020 po dłuższym poszukiwaniu okazało się,  że wystarczy zmienić:

ppt (osnap (cadr ent) "nea")

na 

ppt (osnap (cadr ent) "_nea")

i lisp działa, przepraszam autorów zwTraffic o niesłuszne oskarżenia :)

 

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się