- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, As a part of my work, I have to highlight all the dimensions that are below 5 feet in a drawing. This is the code I have, can some one help me with this lisp- (also, what if I need to highlight the selected ones in a different color?)
(defun c:qcdim ()
(setq ss (ssget "_X" '((0 . "DIMENSION")))) ; Select all entities with DXF code 0 equal to "DIMENSION"
(if (/= (sslength ss) 0) ; If there are dimensions in the selection set
(progn
(setq doc (vla-get-activedocument (vlax-get-acad-object))) ; Get the active document
(vla-startundomark doc) ; Start an undo mark
(repeat (sslength ss) ; Loop through each entity in the selection set
(setq obj (vlax-ename->vla-object (ssname ss 0))) ; Get the ActiveX object of the entity
; Check if the object is a dimension
(if (= "AcDbDimension" (vla-get-objectname obj))
(progn
(setq dim_value (vla-get-dimtextoverride obj)) ; Get the dimension value
(setq dim_value_inch (vla-converttodouble dim_value acFeet acInches)) ; Convert dimension value to inches
; Check if the dimension value is less than 60 inches (5 feet)
(if (< dim_value_inch 60)
(vla-put-isselected obj :vlax-true) ; Select the dimension
(vla-put-isselected obj :vlax-false)
)
)
)
(setq ss (ssdel (ssname ss 0) ss)) ; Remove the entity from the selection set
)
(vla-regen doc) ; Regenerate the drawing
(vla-endundomark doc) ; End the undo mark
(princ "\nAll dimensions less than 5 feet selected.")
)
(princ "\nNo dimensions found.")
)
(princ)
)
Solved! Go to Solution.