LISP that creates ordinate dimensions from the insertion points of selected blocks, to the insertion point of a different selected block

LISP that creates ordinate dimensions from the insertion points of selected blocks, to the insertion point of a different selected block

jfrantzTW9AS
Explorer Explorer
262 Views
2 Replies
Message 1 of 3

LISP that creates ordinate dimensions from the insertion points of selected blocks, to the insertion point of a different selected block

jfrantzTW9AS
Explorer
Explorer

Hello, I am looking to have a lisp created that will prompt the user to select multiple blocks, then select 1 reference block, and create ordinate dimensions from the multiple blocks insertion points to the reference block insertion point. The ordinate dimensions would be measured from the datum (set at the reference block's insertion point) to the insertion points of each of the other selected blocks. Thank you!

0 Likes
263 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant

Illustrate, please.  The insertion point of the datum reference Block would be set as a UCS Origin, and then the Ordinate Dimensions made at the other Blocks [easy enough, so far], but talk about positioning of the text elements -- too many possibilities:

Kent1Cooper_1-1690556780234.png

Always the same relationship regardless of Block name, or size, or insertion point position within the Block, or...?  Always to the same side(s), at the same distance(s) from the dimensioned location?  Always with or always without a jog?  Etc., etc.

Kent Cooper, AIA
0 Likes
Message 3 of 3

komondormrex
Mentor
Mentor

hey,

are you looking something like this?

(defun c:add_ordinates (/ ordinates_to_block_list reference_block_insertion_point block_insertion_point)
	(prompt "Select blocks to be ordinated.")
	(setq ordinates_to_block_list (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget '((0 . "insert"))))))
		  reference_block_insertion_point (cdr (assoc 10 (entget (car (entsel "\nPick reference block: ")))))

	)
	(foreach block ordinates_to_block_list
			(vla-adddimordinate (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))) 
								(vlax-3d-point (cdr (assoc 10 (entget block)))) 
								(vlax-3d-point reference_block_insertion_point)
								:vlax-true
			)
			(entmod (subst (cons 10 reference_block_insertion_point) (assoc 10 (entget (entlast))) (entget (entlast)))) 
			(entmod (subst (cons 13 (setq block_insertion_point (cdr (assoc 10 (entget block))))) (assoc 13 (entget (entlast))) (entget (entlast)))) 
			(entmod (subst (cons 14 block_insertion_point) (assoc 14 (entget (entlast))) (entget (entlast)))) 
			(vla-adddimordinate (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)))) 
								(vlax-3d-point (cdr (assoc 10 (entget block))))
								(vlax-3d-point reference_block_insertion_point)
								:vlax-false
			)
			(entmod (subst (cons 10 reference_block_insertion_point) (assoc 10 (entget (entlast))) (entget (entlast)))) 
			(entmod (subst (cons 13 block_insertion_point) (assoc 13 (entget (entlast))) (entget (entlast)))) 
			(entmod (subst (cons 14 block_insertion_point) (assoc 14 (entget (entlast))) (entget (entlast)))) 
	)
	(princ)
)

 

0 Likes