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

Can you please change the unit Meter to Foot in this program ?

8 REPLIES 8
Reply
Message 1 of 9
smallƑish
540 Views, 8 Replies

Can you please change the unit Meter to Foot in this program ?

The program I got from here only, Generating very good area of the table but in meters only.

 

Even all my drawings are in millimeters for Calculations, feet area required. If possible please convert the meter to feet, or a switch to chose the value at least in meter or feet or millimeters

 

Thank you 

8 REPLIES 8
Message 2 of 9
pbejse
in reply to: smallƑish


@smallƑish wrote:

chose the value at least in meter or feet or millimeters..


Are you using meter or milimeter by default? If you need to convert we need to know what is your base drawing units.

 

Message 3 of 9
diagodose2009
in reply to: pbejse

If you are using milimeter , then you replace

 

 

area  (vlax-curve-getarea e)

 

 

with the line , You type the command ARJ[ente] at line command...

 

 

area (vlax-curve-getarea e) 
area (if (numberp area) (* area 0.00001) area)

 

 

You use these number/s 

 

*survey_foot,survey_feet  ;  Based on the old standard of exactly 39.37 in/m.
-1, 0, 1, 0,-1,0.30480060960122,0.0
*foot,feet,ft,'
-1, 0, 1, 0,-1,0.3048,0.0
*acre(s)
-2, 0, 2, 0,-2,4046.8564,0.0

 

 

Message 4 of 9
devitg
in reply to: smallƑish

@smallƑish my half cent

 

(defun c:A2E (/ ss i area layer all_data pts csv_file openfile) ; Export Polyline Data
;;			pBe Sep 2018			;;
  ;;modified by devitg mar 2022
  (if (and
        (progn(setq all_data nil)
              (setq ss (ssget '((0 . "LWPOLYLINE"))))
	        (repeat (setq i (sslength ss))
	          (setq e     (ssname ss (setq i (1- i))))
                     (setq   ent   (entget e))
	             (setq      area  (vlax-curve-getarea e))
                      (setq area-meter (/ area 1000.0 1000.0))
                  (setq area-feet (/ area (* 12 25.4) (* 12 25.4)))
                      (setq  data  (mapcar '(lambda (d)(cdr (assoc d ent))) '( 8 70 5)))
	               (setq    pts   (mapcar 'cdr
	                              (vl-remove-if-not
	                                '(lambda (d)
	                                   (= 10 (car d))
	                                 )
	                                ent
	                              )
	                      )
	          )
		(setq all_data
	                   (cons
	                     (list 
				(cond
                              		((null (setq ssText (ssget "_CP" pts '((0 . "TEXT")))))	"-"
                                    							)
                                   	((= (sslength ssText) 1)
                                    		(cdr (assoc 1 (entget (ssname ssText 0))))
                                                  				)
                                   	((substr 
					   (apply 'strcat
					      (mapcar '(lambda (st)
					                 (strcat " | " st))
							(vl-sort
							  (mapcar '(lambda (s)
							             (cdr (assoc 1 (Entget s)))
							           )
							          (vl-remove-if 'listp (mapcar 'cadr (ssnamex ssText)))
							  )
							  (function (lambda (a b)
							              (< a b)
							            )
								  )
								)
						              )
							)
						   4
						)
					)
                                    )                                
	                           area
                                area-meter
                                area-feet
	                           (car data)
	                           (if (zerop ( logand 1 (cadr data))) "No" "Yes")
                            	  (caddr data)
	                     )
	                     all_data
	                   )
	            	)
  
               all_data
               );end repeat
	        (setq csv_file (getfiled "Save CSV File"
	                                 (strcat
	                                   (getvar 'dwgprefix)
	                                   (vl-filename-base (getvar 'dwgname))
	                                   ".csv"
	                                 )
	                                 "csv"
	                                 45
	                       )
	        	)
          );end progn
	        );end AND
;;;(("room-1" 1.41249e+06 1.41249 15.204 "0" "Yes" "398")) 

        (progn
          (setq openfile (open csv_file "w"))
          (write-line
            "Text inside polyline, Area (mm2),(m2),(feet2),Layer,Closed,Handle"
            openfile
          )
          (foreach itm (vl-sort all_data
                                '(lambda (a b) (< (Cadr a) (cadr b)))
                       )
            ;(setq itm (car all_data))
            (write-line
              (Strcat (Car itm)
                      ","
                      (rtos (Cadr itm) 2 2)
                      ","
                      (rtos (nth 2 itm) 2 2)
                      ","
                      (rtos (nth 3 itm) 2 2)
                      ","
                      (nth 4 itm)
                      ","
                      (nth 5 itm)
                      ","
                      (last itm)
              ) ;_  Strcat
              openfile
            ) ;_  write-line
          )
          (close openfile)
          (startapp "notepad" csv_file)
        );end progn
      );end if
  (princ)

);end c:A2E


;|«Visual LISP© Format Options»
(100 2 1 2 T " " 100 6 0 0 1 nil T nil T)
;*** DO NOT add text below the comment! ***|;
Message 5 of 9
Sea-Haven
in reply to: devitg

Sometimes use 1E is easier

 

(/ area 1000.0 1000.0)
(/ area 1E6)
Message 6 of 9
smallƑish
in reply to: pbejse

All My drawings are in millimeter.

Message 7 of 9
hak_vz
in reply to: smallƑish

Here is your code modified to show result converted from mm^2 to ft^2.

1 mm^2 = 1.07639104 × 10-5 square feet

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 8 of 9
pbejse
in reply to: smallƑish


@smallƑish wrote:

All My drawings are in millimeter.


command: A2E

Choose units [ME/MM/Feet]: 

 

HTH

 

Message 9 of 9
diagodose2009
in reply to: pbejse

Hello guy/s

x If finished  your program ,,..............

I extend the formulas more calc for quick exactly.

You need the precision set be (rtos no 2 9) because you check

 

 

Text inside polyline,Polyline[feet]Area,Layer.Close,Handle
room-3,14.6,0,Yes,"39A"
room-1,15.2,0,Yes,"398"
room-2,21.53,0,Yes,"395"
-------------------------------------------------------------------------------------------------------------------
room-3,14.597799578,0,Yes,"39A"
room-1,15.203962408,0,Yes,"398"
room-2,21.527820833,0,Yes,"395"

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report