thanhdattdk Posted June 3, 2017 Posted June 3, 2017 Hello everbody. Thank all for read my thread I want to determine the blue dot coordinates but fail. i hope everybody help me code lisp My code ;;------------------------------=={ 2017 }==-------------------------------;; (prompt "\n=={Created by PHÒNG TKCD - CIENCO625******************************}==") (prompt "\n=={Thanhdattdk@gmail.com******************************}==") ;;---------------------------------------------------------------------------;; (defun c:mm () (princ "\nCh\U+1ECDn c\U+00E1c Hatch c\U+1EA7n t\U+1EA1o l\U+1EA1i Boundary : ") (command "-style" "DIENTICH" "arialbd_0.ttf" "0" "0.9" "0" "n" "n") (setq tnct (ssget (list (cons 0 "HATCH")))) (setq i 0) (setq lmt (sslength tnct)) (while (< i lmt) (setq e (ssname tnct i)) (setq laynd (entget e)) [b][color="blue"](setq td (cdr (assoc 10 laynd)))[/color][/b] ;tao tap rong de tinh dien tinh cho Hatch tao nhieu PL (setq S 0) (setq Q (entlast) AA (ssadd)) (command "-hatchedit" e "B" "P" "") (while (setq Q (entnext Q)) (setq AA (ssadd Q AA)) ) ;tinh dien tich cac phan tu cua group vua tao (setq j 0) (setq dat (sslength AA)) (while (< j dat) (setq doituong (ssname AA j)) (command "area" "o" doituong) (setq Si (getvar "area")) (setq S (+ S Si)) (setq j (+ j 1)) ) (princ S) (princ td) (command ".ERASE" AA "") ;viet text len vi tri hatch (command "text" "ml" td "2.5" "0" S "") (setq i (+ i 1)) );END WHILE (princ)) Quote
BIGAL Posted June 3, 2017 Posted June 3, 2017 A quicker way maybe is use BPOLY it makes a pline of your hatch boundary, you can then get simply the co-ordinates of the new pline and theer are some centroid routines out there as well. Quote
Roy_043 Posted June 3, 2017 Posted June 3, 2017 Since you are using the point to position text, why not calculate the center of the boundingbox instead of the centroid? Quote
thanhdattdk Posted June 5, 2017 Author Posted June 5, 2017 thank you very much. (setq Rec (acet-ent-geomextents e) pt1 (nth 0 Rec);lay dinh pt2 (nth 1 Rec);lay dinh mid (acet-geom-midpoint pt1 pt2) );setq Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.