Message 1 of 15
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to extract the insertion point of a block, I am using the code bellow but I am getting a different result than the value under Properties->Geometry
the output: Insertion Point: -969.46, 109.50, 936.81
Expected output: 969.46, 936.81, 109.50
the rotation is 0
how can I fix it and the right value ?
(defun c:PrintBlockInsertionPoint (/ ent insertion-point wcs-point)
;; Prompt the user to select a block
(setq ent (car (entsel "\nSelect a block: ")))
;; Check if the entity is a valid block reference
(if (and ent (= "INSERT" (cdr (assoc 0 (entget ent)))))
(progn
;; Extract the insertion point using (cdr (assoc 10 ent)) in WCS
(setq wcs-point (cdr (assoc 10 (entget ent))))
;; Print both WCS coordinates
(princ (strcat "\n Insertion Point: "
(rtos (car wcs-point) 2 2) ", "
(rtos (cadr wcs-point) 2 2) ", "
(rtos (caddr wcs-point) 2 2)))
)
(princ "\nSelected entity is not a block reference.")
)
(princ) ;; Exit quietly
)
Solved! Go to Solution.