Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert Line Problem, Help!!

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
alexlibrelon
287 Views, 6 Replies

Insert Line Problem, Help!!


This routine does not work on versions above the map autocad 2004, what may be happening?



regards!





(defun c:IL (/ pt pt1 pt2 objpt1 objpt2 pilha divisa contador cont plista lista

XIZ XFZ YIZ YFZ XYIZ XYFZ XIPT1 XFPT1 YIPT1 YFPT1 XYIPT1 XYFPT1

XIPT2 XFPT2 YIPT2 YFPT2 XYIPT2 XYFPT2)

(command "undo" "M")

(COMMAND "APERTURE" "50")

(SETQ CONTADOR 0)

(Setq pt nil)

(setq pt1 nil)

(setq pt2 nil)

(setq OBJpt1 nil)

(setq OBJpt2 nil)

(setq pilha nil)

(setq divisa nil)

(setq pilha (ssget '((8 . "divisa" ))))

(setq cont (sslength pilha))

(WHILE (< contador cont)

(setq PLISTA (ssname pilha contador))

(setq lista (entget PLISTA))

(setq pt (cdr (assoc 10 lista )))

(command "erase" plista "")

(command "osnap" "NEAREST")

(command "insert" "*c:/temp/linha" pt "1" "1" "0" )

(command "osnap" "None")

(SETQ XIz (- (CAR pt) 10))

(SETQ XFz (+ (CAR pt) 10))

(SETQ YIz (- (CADR pt) 10))

(SETQ YFz (+ (CADR pt) 10))

(SETQ XYIz (LIST XIz YIz))

(SETQ XYFz (LIST XFz YFz))

(command "zoom" "w" XYIz XYFz )

(setq pt1 (cdr (assoc 10 (entget (SETQ DIVISA (entlast))))))

(setq pt2 (cdr (assoc 11 (entget (SETQ DIVISA (entlast))))))

(SETQ XIpt1 (- (CAR pt1) 0.2))

(SETQ XFpt1 (+ (CAR pt1) 0.2))

(SETQ YIpt1 (- (CADR pt1) 0.2))

(SETQ YFpt1 (+ (CADR pt1) 0.2))

(SETQ XYIpt1 (LIST XIpt1 YIpt1))

(SETQ XYFpt1 (LIST XFpt1 YFpt1))



(SETQ XIpt2 (- (CAR pt2) 0.2))

(SETQ XFpt2 (+ (CAR pt2) 0.2))

(SETQ YIpt2 (- (CADR pt2) 0.2))

(SETQ YFpt2 (+ (CADR pt2) 0.2))

(SETQ XYIpt2 (LIST XIpt2 YIpt2))

(SETQ XYFpt2 (LIST XFpt2 YFpt2))

(gc)

(SETQ OBJpt1 (SSGET "C" XYIpt1 XYFpt1 '((8 . "alinha" ))))

(SETQ OBJpt2 (SSGET "C" XYIpt2 XYFpt2 '((8 . "alinha" ))))

(gc)

(if (or (/= OBJpt1 NIL)(/= OBJpt2 NIL))

(progn

(COMMAND "ROTATE" DIVISA "" PT "90" )

(setq pt1 (cdr (assoc 10 (entget (SETQ DIVISA (entlast))))))

(setq pt2 (cdr (assoc 11 (entget (SETQ DIVISA (entlast))))))

(SETQ XIpt1 (- (CAR pt1) 0.2))

(SETQ XFpt1 (+ (CAR pt1) 0.2))

(SETQ YIpt1 (- (CADR pt1) 0.2))

(SETQ YFpt1 (+ (CADR pt1) 0.2))

(SETQ XYIpt1 (LIST XIpt1 YIpt1))

(SETQ XYFpt1 (LIST XFpt1 YFpt1))

(gc)

(SETQ OBJpt1 (SSGET "C" XYIpt1 XYFpt1 '((8 . "alinha" ))))

;(command "rectangle" XYIpt1 XYFpt1)

(if (/= OBJpt1 NIL)

(progn

(COMMAND "ROTATE" DIVISA "" PT "30" )

)

)

(SETQ XIpt2 (- (CAR pt2) 0.2))

(SETQ XFpt2 (+ (CAR pt2) 0.2))

(SETQ YIpt2 (- (CADR pt2) 0.2))

(SETQ YFpt2 (+ (CADR pt2) 0.2))

(SETQ XYIpt2 (LIST XIpt2 YIpt2))

(SETQ XYFpt2 (LIST XFpt2 YFpt2))

(SETQ OBJpt2 (SSGET "C" XYIpt2 XYFpt2 '((8 . "alinha" ))))

;(command "rectangle" XYIpt2 XYFpt2)

(if (/= OBJpt2 NIL)

(progn

(COMMAND "ROTATE" DIVISA "" PT "30" )

)

)

)

)

(setq OBJpt1 nil)

(setq OBJpt2 nil)

;(command "erase" plista "")

(setq contador (+ 1 contador))

(gc)

)

(COMMAND "APERTURE" "3")






Alex Librelon

Brazil
Edited by: alexlibrelon on Nov 6, 2008 11:59 PM
Alex Librelon
Projetista Master - Youtube | Blog | Linkedin

- Marque a resposta que resolveu o seu problema como solução, isso ajuda os outros usuários em suas buscas;
- Clique em "Curtir" caso a resposta tenha ajudado;
6 REPLIES 6
Message 2 of 7
EC-CAD
in reply to: alexlibrelon

Try changing:
(command "insert" "*c:/temp/linha" pt "1" "1" "0" )
To:
(command "_-insert" "c:/temp/linha" pt "1" "1" "0" )

Bob
Message 3 of 7
devitg
in reply to: alexlibrelon

As the dash , avoid open the insert Dialog Box.

Message 4 of 7
alexlibrelon
in reply to: alexlibrelon

The routine works for a while and then, AutoCAD Map and closes without complete without saving.
I thought it was the use of memory but it is not.
What could be?

Thanks for the tips and tomorrow, I will try the tips above.

Alex.
Alex Librelon
Projetista Master - Youtube | Blog | Linkedin

- Marque a resposta que resolveu o seu problema como solução, isso ajuda os outros usuários em suas buscas;
- Clique em "Curtir" caso a resposta tenha ajudado;
Message 5 of 7
EC-CAD
in reply to: alexlibrelon

Try commenting out all the:
(gc)
... lines.

Bob
Message 6 of 7
alexlibrelon
in reply to: alexlibrelon

Solved the problem with the help of you.

Using -insert in the insert.

Thank you all and sorry the English.



Alex.

Alex Librelon
Projetista Master - Youtube | Blog | Linkedin

- Marque a resposta que resolveu o seu problema como solução, isso ajuda os outros usuários em suas buscas;
- Clique em "Curtir" caso a resposta tenha ajudado;
Message 7 of 7
EC-CAD
in reply to: alexlibrelon

You are very Welcome.
Cheers.

Bob
http://www.bobscadshop.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost