Re: Error: application is locked and cannot be unloaded.

#3
QuanNguyen wrote:
Tue Dec 20, 2022 9:18 am
Please refer to this, hope this helps you.
viewtopic.php?p=7032&hilit=application+ ... 3f21#p7032

Code: Select all

(vl-load-com)
I read it but where can I place this code in this script ? :

Code: Select all

(defun c:areacal (/ area dxf_ent ent js n nb ptlst pt_ins)
	(if (setq js 	
				(ssget '(
							(0 . "LWPOLYLINE")
							(-4 . "<AND")
							(-4 . "&")
							(70 . 1)
							(-4 . ">")
							(90 . 2)
							(-4 . "<")
							(90 . 5)
							(-4 . "AND>")
						)
				)
		)
		(progn
			(repeat (setq nb (sslength js))
				(setq 
					ent     (ssname js (setq nb (1- nb)))
					dxf_ent (entget ent)
					ptlst	(mapcar 'cdr
								(vl-remove-if-not
								'(lambda (x) (= (car x) 10))
								dxf_ent
								)
							)
					n	      (length ptlst)
					pt_ins  (list 	(/ (apply '+ (mapcar 'car ptlst)) n)
									(/ (apply '+ (mapcar 'cadr ptlst)) n)
							)
					area    (vla-get-Area (vlax-ename->vla-Object ent))
				)
				(entmake
					(list
						'(0 . "TEXT")
						(cons 10 pt_ins)
						(cons 40 (getvar "TEXTSIZE"))
						(cons 1 (strcat "Area= " (rtos area)))
						(cons 72 4)
						(cons 11 pt_ins)
					)
				)
			)		
		)	
	)
(princ "End AREA calculation!")
)
Patrick Depoix
Architecte D.P.L.G. & Historien-chercheur en histoire de l'Architecture
cron