Message 1 of 18
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i have edit this lisp and i hope some help to get the area link the hatch that make area in the block attribut change when change the hatch area after insertaion
this the code
(defun c:fool ( / sset ent obj minPt maxPt p1 p2 midPt)
(setq fmt "%lu6%qf1" ;; Field Formatting
tag nil ;; Optional predefined attribute tag
)
(defun *error* ( msg )
(LM:endundo (LM:acdoc))
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(setq sset (ssget '((0 . "HATCH"))) i 0)
;(0 . "ARC,CIRCLE,ELLIPSE,HATCH,*POLYLINE,REGION,SPLINE")
(repeat (sslength sset)
(setq ent (ssname sset i))
(setq obj (vlax-ename->vla-object ent))
(vla-getboundingbox obj 'minPt 'maxPt)
(setq areass (vla-get-area obj))
(setq LAYERNAME (vla-get-layer obj))
(setq p1 (vlax-safeArray->list minPt))
(setq p2 (vlax-safeArray->list maxPt))
(setq midPt (mapcar '(lambda (x1 x2) (/ (+ x1 x2) 2.0)) p1 p2))
(setq areas (rtos areass))
(cond ( (/= (getvar 'attdia) 0) ;sets attdia to 0 if not 0
(setq atd (getvar 'attdia))
(setvar 'attdia 0)
)
);end_cond
(cond ( (/= (getvar 'attreq) 1) ;sets attreq to 1 if not 1
(setq atq (getvar 'attreq))
(setvar 'attreq 1)
)
);end_cond
(command "_-insert" "myblock" midPt 1 1 0 LAYERNAME areas aread 88)
;(entmakex (list (cons 0 "CIRCLE")(cons 62 1)(cons 10 midPt)(cons 8 LAYERNAME)(cons 40 (* (getvar "viewsize") 0.03))))
(setq i (1+ i))
)
(princ)
)
i read some thing like that but i cant get it in my edit lisp
(vl-load-com)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
spc (vlax-get doc (if (= 1 (getvar 'CVPORT)) 'PaperSpace 'ModelSpace)))
(while (setq ent obj)
(if (vlax-property-available-p (setq obj0 (vlax-ename->vla-object ent)) 'Area)
(setq aread
(strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectID obj0)) ">%).Area \\f \"%lu2%pr2\">%"))
Solved! Go to Solution.