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

Plotting from Autolisp

3 REPLIES 3
Reply
Message 1 of 4
angelo
432 Views, 3 Replies

Plotting from Autolisp

I need to plot in a file some windows from a LISP,
like (command "-plot"...
The windows are defined in a list of points like
(((0 0 0)(10 10 0))...) defining lower-left and
upper-right corners. Each .plt file must be saved
with a different name.
Is it possible from AutoLISP in 2000?
Thanks a lot!

Angelo Agostini
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: angelo

Yes,

this is an example:

(command
"_.PLOT" "_W" (car lmts_dwg) (cadr lmts_dwg) 5 "_N" "_N" "_Y" "_M"
"0.0,0.0" "" 0
"" (strcat "1=" (ALE_RTOS_DZ8 (caddr lmts_dwg))) 0 "" prfx&name
)

Marco

"angelo" ha scritto nel messaggio
news:ef696aa.-1@WebX.SaUCah8kaAW...
> I need to plot in a file some windows from a LISP,
> like (command "-plot"...
> The windows are defined in a list of points like
> (((0 0 0)(10 10 0))...) defining lower-left and
> upper-right corners. Each .plt file must be saved
> with a different name.
> Is it possible from AutoLISP in 2000?
> Thanks a lot!
> Angelo Agostini
>
>
Message 3 of 4
angelo
in reply to: angelo

Grazie, proverò...
angelo
Message 4 of 4
neerav_karani
in reply to: angelo

I was facing the same issue and couldn't find a neat solution for it. I am posting this here with the hope that it will help someone trying to do something similar.

 

First, a function to write the coordintes of the top-left and bottom-right points of all the windows I wanted to convert to pdfs:

 

(defun C:GetCoordinates()
 
  (if (setq f(open "d:/filename.txt" "w"))
  (progn
      (setq i 1)
      (while (<= i 50)
    
        (setq p1 (getpoint "Top Left Point"))
        (setq p2 (getpoint "Bottom Right Point"))
      
        (setq p1x (car p1))
        (setq p1y (cadr p1))
        (setq p2x (car p2))
        (setq p2y (cadr p2))
      
        (write-line (strcat (itoa i) "," (rtos p1x 2 3) "," (rtos p1y 2 3) "," (rtos p2x 2 3) "," (rtos p2y 2 3) ",") f)
        (setq i (+ i 1)) 
     )
  )
  )
)

 

Now, we read the coordinates and convert the windows to pdfs:

 

(defun C:ConvertToPDF()

  (if (setq f(open "d:/filename.txt" "r"))
  (progn
       (setq j 1)
       (while ( <= j 50 )
       (setq txtLine(read-line f))
       (setq len (strlen txtLine))
       (setq i 1)
       (setq commaCounter 0)
       (setq first 1)
       (setq second 1)

       (while (<= i len)
         (if (= (substr txtLine i 1) ",")
         (progn
            (setq second i)              
            (setq str (substr txtLine  first (- second first)))
            (setq first (+ second 1))
            (setq commaCounter (+ commaCounter 1))
            (cond ((= commaCounter 1) (setq filename str))
                      ((= commaCounter 2) (setq pt1x (atof str)))
                      ((= commaCounter 3) (setq pt1y (atof str)))
                      ((= commaCounter 4) (setq pt2x (atof str)))
                      ((= commaCounter 5) (setq pt2y (atof str)))
                    )
          )
          )
         (setq i(+ i 1))
       )

       (setq point1 (list pt1x pt1y 0))
       (setq point2 (list pt2x pt2y 0))
       (setq filename2 (strcat "d:/TestPDF/" filename ".pdf"))
       (command "-plot" "y" "" "Dwg To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)" "M"
       "" "N" "w" point1 point2 "" "c" "Y" "." "Y" "" filename2 "N" "y")
    
       (setq j (+ j 1))
     )
  )
  )

)

 

 

Tags (3)

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

Post to forums  

Autodesk Design & Make Report

”Boost