Find overridden dimensions but exclude checking in certain layers

Find overridden dimensions but exclude checking in certain layers

jigar.patel43D5B
Explorer Explorer
255 Views
2 Replies
Message 1 of 3

Find overridden dimensions but exclude checking in certain layers

jigar.patel43D5B
Explorer
Explorer

Hi all,

Longtime ACAD user here, but with no lisp skills.

I am trying to create/modify a LISP that automatically looks in entire drawing, with a few exclusions, to find overridden dimensions and moves to _FORCED_DIMS layer so that it gets printed with different color. There is an existing FFD lisp which works well but for my purpose, I want to add exclusions so that it doesn't look into layers that are turned off and/or frozen, set to No Plot and Defpoints layer. The attached lisp partially works, but it still selects overridden dimensions from the turned off layers and from layers set to No Plot.

Can someone help me fix the lisp so that it doesn't select the dimensions in turned off and no plot layers ?

The correct lisp should exclude checking into following layer types:

1. Turned off layers

2. Frozen layers

3. Turned off AND Frozen layers

4. Layers set to No Plot (regardless of layer visibility on/off or frozen/unfrozen)

5. Defpoints layer

Thank you

0 Likes
Accepted solutions (2)
256 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant
Accepted solution

Hi,

 

The flag 4 of layer 70 dxf group stands for Locked, not Off. Off layers have a negative 62 group value. See this topic.

 

You can get the excluded layers and use them in a selection filter.

 

  (setq excludedLayers "DEFPOINTS")
  (while (setq layername (cdr (assoc 2 (tblnext "layer" (not layername)))))
    (setq layer_data (entget (tblobjname "layer" layerName)))
    (if	(or
	  (< 0 (logand (cdr (assoc 70 layer_data)) 5)) ; Layer is frozen (1) or locked (4)
	  (minusp (cdr (assoc 62 layer_data))) ; Layer is turned OFF
	  (= 0 (cdr (assoc 290 layer_data))) ; Layer is set to "No Plot"
	)
      (setq excludedLayers (strcat excludedLayers "," layerName))
    )
  )

  (setq	ss (ssget "_X"
		  (list	(cons 0 "DIMENSION")
			(cons -4 "<NOT")
			(cons 8 excludedLayers)
			(cons -4 "NOT>")
		  )
	   )
  )

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

jigar.patel43D5B
Explorer
Explorer
Accepted solution

@_gile 
Thank you.

Got it work. For future readers, Here's the updated LISP if it helps.

This lisp will not look into layers that are either turned off, frozen, set to no plot or defpoints. It also excludes the dimensions if overridden text includes <> as they do include a true dimension value within the overridden text, for example, <>(TYP) or  %%p<>

 

0 Likes