Jump to content

Recommended Posts

Posted

I have tested the new code, but still does nothing with block contents... Sorry. :-)

  • Replies 34
  • Created
  • Last Reply

Top Posters In This Topic

  • andy_06

    15

  • Grrr

    13

  • Aftertouch

    4

  • Dadgad

    1

Top Posters In This Topic

Posted
Hmm, I can't seem to find the problem, edited the code to regen All viewports (the red text). If it still doesn't work I will try to re-write the block iteration with visual lisp.

 

The problem is caused by line 14:

(if (assoc 6 enx)

This should be:

(if (assoc 6 subEnx)

Posted
The problem is caused by line 14:

(if (assoc 6 enx)

This should be:

(if (assoc 6 subEnx)

 

Thanks, Roy! I was wondering why it won't work.

Dammit, I might need to buy a pair of glasses.

I've fixed the last code I posted here, due Roy's comment.

Posted

that did the trick!

Thanks guys. :-)

  • 1 month later...
Posted
Corrected the code in my last post. Sorry, it was confusing with these "0" and "0existing" layer names.

 

Hi Grrr,

 

I have been using the code you did for me and it has really saved me a lot of time.

One slight bug that I have with it (I didn't think of this before) is that there are some occasions where there are lines that are lineweight 0.50mm that are Color 151 instead of Color red. The current code puts these onto 0existing layer with the red lines but they need to go onto a different layer (0existingMP and turn to Color blue).

 

Is this possible??

 

(defun C:test ( / lyr1 lyr0 acDoc emakeLay SSX i e enx ce )

(setq lyr1 "Layer 1");<- type your layername here
(setq lyr0 "0existing");<- type your layername for lineweight 0.50mm

(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-map-collection (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (x) (vla-put-Lock x :vlax-false)))
(defun emakeLay (nm)
	(or (tblsearch "LAYER" nm)
		(progn
			(alert (strcat "\nLayer \"" nm "\" does not exist, creating it!"))
			(entmakex (list (cons 0 "LAYER")(cons 100 "AcDbSymbolTableRecord")(cons 100 "AcDbLayerTableRecord")(cons 2 nm)(cons 70 0)))
		)
	)
	(princ)
); defun emakeLay
(mapcar 'emakeLay (list lyr0 lyr1))

(if (setq SSX (ssget "_X" (list (cons 410 (getvar 'ctab)))))
	(progn
		(setq ce (getvar 'cmdecho))
		(setvar 'cmdecho 0)
		(command "_.SCALE" SSX "" '(0. 0. 0.) 5)
		(repeat (setq i (sslength SSX))
			(setq e (ssname SSX (setq i (1- i))))
			(setq enx (entget e))
			(if (= lyr1 (cdr (assoc 8 enx)))
				(setq enx (subst (cons 8 "0") (assoc 8 enx) enx))
			)
			(if (= (cdr (assoc 62 enx)) 35)
				(setq 
					enx (subst (cons 8 "0") (assoc 8 enx) enx)
					enx (subst (cons 62 256) (assoc 62 enx) enx)
				)
			)
			(if (= (cdr (assoc 370 enx)) 50)
				(progn
					(if (and (assoc 62 enx) (/= (cdr (assoc 62 enx)) 4)) 
						(setq enx (subst (cons 62 256) (assoc 62 enx) enx))
					)
					(setq enx (subst (cons 8 lyr0) (assoc 8 enx) enx))
				)
			)
			(entupd (cdr (assoc -1 (entmod enx))))
			(if (= (cdr (assoc 62 enx)) 4)
				(entdel e)
			)
		)
		(vla-Regen acDoc acActiveViewport)
		(vla-ZoomExtents (vlax-get-acad-object))
		(if ce (setvar 'cmdecho ce))
	)
)
(princ)
);| defun |; (vl-load-com) (princ)

Posted

Try this, Andy:

(defun C:test ( / lyr1 lyr0 lyrMP acDoc emakeLay SSX i e enx ce )

(setq ; type your layernames here
	lyr1 "Layer 1"  
	lyr0 "0existing"  
	lyrMP "0existingMP"
); setq

(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-map-collection (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (x) (vla-put-Lock x :vlax-false)))
(defun emakeLay (nm)
	(or (tblsearch "LAYER" nm)
		(progn
			(alert (strcat "\nLayer \"" nm "\" does not exist, creating it!"))
			(entmakex (list (cons 0 "LAYER")(cons 100 "AcDbSymbolTableRecord")(cons 100 "AcDbLayerTableRecord")(cons 2 nm)(cons 70 0)))
		)
	)
	(princ)
); defun emakeLay
(mapcar 'emakeLay (list lyr0 lyr1 lyrMP))

(if (setq SSX (ssget "_X" (list (cons 410 (getvar 'ctab)))))
	(progn
		(setq ce (getvar 'cmdecho))
		(setvar 'cmdecho 0)
		(command "_.SCALE" SSX "" '(0. 0. 0.) 5)
		(repeat (setq i (sslength SSX))
			(setq e (ssname SSX (setq i (1- i)))) ; "nth" entity for the selection set
			(setq enx (entget e)) ; dxf data of the "nth" entity
			(if (and (assoc 62 enx) (= (cdr (assoc 62 enx)) 4)) ; if the entity has assigned index color 4 ( Cyan )
				(entdel e) ; erase the entity
				(progn ; otherwise do the stuff below
					(cond ; analyse the "stuff" using (cond) - condition
						( (= lyr1 (cdr (assoc 8 enx))) ; entity layer is "Layer 1"
							(setq enx (subst (cons 8 "0") (assoc 8 enx) enx)) ; set entity to layer "0"
						)
						( (and (assoc 62 enx) (= (cdr (assoc 62 enx)) 35)) ; entity has assigned index color 35
							(setq 
								enx (subst (cons 8 "0") (assoc 8 enx) enx) ; set entity to layer "0"
								enx (subst (cons 62 256) (assoc 62 enx) enx) ; set entity's color to "ByLayer"
							)
						)
						( (and (assoc 370 enx) (= (cdr (assoc 370 enx)) 50)) ; theres assigned lweight and is 0.5
							(if (assoc 62 enx) ; if entity has assigned index color   
								(setq enx (subst (cons 62 256) (assoc 62 enx) enx)) ; change it to "bylayer"
							)
							(setq enx (subst (cons 8 lyr0) (assoc 8 enx) enx)) ; set entity's layer on "0existing"
						)
						( (and (= (cdr (assoc 370 enx)) 50) (assoc 62 enx) (= (cdr (assoc 62 enx)) 151) ) ; theres assigned lweight 0.5 and index color 151
							(setq
								enx (subst (cons 8 lyrMP) (assoc 8 enx) enx) ; set entity to layer "0existingMP"
								enx (subst (cons 62 5) (assoc 62 enx) enx) ; set entity's index color to 5 ( Blue )
							)
						)
					); cond
					(entupd (cdr (assoc -1 (entmod enx)))) ; modify (update) the entity
				); progn
			); if
		); repeat
		(vla-Regen acDoc acActiveViewport)
		(vla-ZoomExtents (vlax-get-acad-object))
		(and ce (setvar 'cmdecho ce))
	)
)
(princ)
);| defun |; (vl-load-com) (princ)

I've included some comments for you to understand whats happening, because your overall request must be collected from the posts in this thread.

Posted
Try this, Andy:

(defun C:test ( / lyr1 lyr0 lyrMP acDoc emakeLay SSX i e enx ce )
   
   (setq ; type your layernames here
       lyr1 "Layer 1"  
       lyr0 "0existing"  
       lyrMP "0existingMP"
   ); setq
   
   (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
   (vlax-map-collection (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (x) (vla-put-Lock x :vlax-false)))
   (defun emakeLay (nm)
       (or (tblsearch "LAYER" nm)
           (progn
               (alert (strcat "\nLayer \"" nm "\" does not exist, creating it!"))
               (entmakex (list (cons 0 "LAYER")(cons 100 "AcDbSymbolTableRecord")(cons 100 "AcDbLayerTableRecord")(cons 2 nm)(cons 70 0)))
           )
       )
       (princ)
   ); defun emakeLay
   (mapcar 'emakeLay (list lyr0 lyr1 lyrMP))
   
   (if (setq SSX (ssget "_X" (list (cons 410 (getvar 'ctab)))))
       (progn
           (setq ce (getvar 'cmdecho))
           (setvar 'cmdecho 0)
           (command "_.SCALE" SSX "" '(0. 0. 0.) 5)
           (repeat (setq i (sslength SSX))
               (setq e (ssname SSX (setq i (1- i)))) ; "nth" entity for the selection set
               (setq enx (entget e)) ; dxf data of the "nth" entity
               (if (and (assoc 62 enx) (= (cdr (assoc 62 enx)) 4)) ; if the entity has assigned index color 4 ( Cyan )
                   (entdel e) ; erase the entity
                   (progn ; otherwise do the stuff below
                       (cond ; analyse the "stuff" using (cond) - condition
                           ( (= lyr1 (cdr (assoc 8 enx))) ; entity layer is "Layer 1"
                               (setq enx (subst (cons 8 "0") (assoc 8 enx) enx)) ; set entity to layer "0"
                           )
                           ( (and (assoc 62 enx) (= (cdr (assoc 62 enx)) 35)) ; entity has assigned index color 35
                               (setq 
                                   enx (subst (cons 8 "0") (assoc 8 enx) enx) ; set entity to layer "0"
                                   enx (subst (cons 62 256) (assoc 62 enx) enx) ; set entity's color to "ByLayer"
                               )
                           )
                           ( (and (assoc 370 enx) (= (cdr (assoc 370 enx)) 50)) ; theres assigned lweight and is 0.5
                               (if (assoc 62 enx) ; if entity has assigned index color   
                                   (setq enx (subst (cons 62 256) (assoc 62 enx) enx)) ; change it to "bylayer"
                               )
                               (setq enx (subst (cons 8 lyr0) (assoc 8 enx) enx)) ; set entity's layer on "0existing"
                           )
                           ( (and (= (cdr (assoc 370 enx)) 50) (assoc 62 enx) (= (cdr (assoc 62 enx)) 151) ) ; theres assigned lweight 0.5 and index color 151
                               (setq
                                   enx (subst (cons 8 lyrMP) (assoc 8 enx) enx) ; set entity to layer "0existingMP"
                                   enx (subst (cons 62 5) (assoc 62 enx) enx) ; set entity's index color to 5 ( Blue )
                               )
                           )
                       ); cond
                       (entupd (cdr (assoc -1 (entmod enx)))) ; modify (update) the entity
                   ); progn
               ); if
           ); repeat
           (vla-Regen acDoc acActiveViewport)
           (vla-ZoomExtents (vlax-get-acad-object))
           (and ce (setvar 'cmdecho ce))
       )
   )
   (princ)
);| defun |; (vl-load-com) (princ)

I've included some comments for you to understand whats happening, because your overall request must be collected from the posts in this thread.

 

 

 

Once again, thanks a lot.

 

 

The notes make it a lot easier to understand as well. The only issue is that it is putting the lineweight 0.50mm (red & blue) onto the "0" layer instead of 0existing & 0existingMP. I have tried playing around with it but I am not having any joy.

Posted
The only issue is that it is putting the lineweight 0.50mm (red & blue) onto the "0" layer instead of 0existing & 0existingMP.

I think you mean lineweight 0.35 mm ?

Posted (edited)
I think you mean lineweight 0.35 mm ?

 

 

Apologies I am probably not making this very clear (after the code is run it creates the new layers but moves everything onto the "0" layer instead of each new layer)

The end result should be.....

Red/lineweight 0.50mm should move to 0existing/color By Layer.

Color 150/lineweight 0.50mm should move to 0existingMP/color By Layer

Everything else on "Layer 1" should move to "0" layer and be color "By Layer".

Edited by andy_06
Posted
Apologies I am probably not making this very clear (after the code is run it creates the new layers but moves everything onto the "0" layer instead of each new layer)

The end result should be.....

Red/lineweight 0.50mm should move to 0existing/color By Layer.

Color 150/lineweight 0.50mm should move to 0existingMP/color By Layer

Everything else on "Layer 1" should move to "0" layer and be color "By Layer".

Translating the above quote into code:

(repeat (setq i (sslength SSX))
(setq e (ssname SSX (setq i (1- i)))) ; "nth" entity for the selection set
(setq enx (entget e)) ; dxf data of the "nth" entity
(if
	(and 
		(assoc 62 enx) (= 1 (cdr (assoc 62 enx))); entity has index color and its "Red" 
		(assoc 370 enx) (= 50 (cdr (assoc 370 enx))); entity has assigned LWeight and its 0.50mm
	)
	(setq
		enx (subst (cons 8 "0existing") (assoc 8 enx) enx); change its layer to "0existing"
		enx (subst (cons 62 256) (assoc 62 enx) enx); change its color to "ByLayer"
	) 
)
(if
	(and 
		(assoc 62 enx) (= 150 (cdr (assoc 62 enx))); entity has index color and its "150" 
		(assoc 370 enx) (= 50 (cdr (assoc 370 enx))); entity has assigned LWeight and its 0.50mm
	)
	(setq
		enx (subst (cons 8 "0existingMP") (assoc 8 enx) enx); change its layer to "0existingMP"
		enx (subst (cons 62 256) (assoc 62 enx) enx); change its color to "ByLayer"
	)
)
(if ; Should the above statements ignore "Layer 1"?, currently example: Red/lineweight 0.50mm on "Layer 1" will be moved to layer "0existing" and will change its color to "ByLayer"
	(and
		(assoc 62 enx) ; that has assigned index color
		(= "Layer 1" (cdr (assoc 8 enx))) ; Everything else on "Layer 1"
	)
	(setq
		enx (subst (cons 8 "0") (assoc 8 enx) enx); change its layer to "0"
		enx (subst (cons 62 256) (assoc 62 enx) enx); change its color to "ByLayer"
	)
)
(entupd (cdr (assoc -1 (entmod enx)))) ; modify (update) the entity
); repeat

You need to replace the whole "repeat" part on the last code with this one.

BTW do you sill want to erase the entities with cyan color?

Posted (edited)

Test.dwg

Translating the above quote into code:

(repeat (setq i (sslength SSX))
(setq e (ssname SSX (setq i (1- i)))) ; "nth" entity for the selection set
(setq enx (entget e)) ; dxf data of the "nth" entity
(if
	(and 
		(assoc 62 enx) (= 1 (cdr (assoc 62 enx))); entity has index color and its "Red" 
		(assoc 370 enx) (= 50 (cdr (assoc 370 enx))); entity has assigned LWeight and its 0.50mm
	)
	(setq
		enx (subst (cons 8 "0existing") (assoc 8 enx) enx); change its layer to "0existing"
		enx (subst (cons 62 256) (assoc 62 enx) enx); change its color to "ByLayer"
	) 
)
(if
	(and 
		(assoc 62 enx) (= 150 (cdr (assoc 62 enx))); entity has index color and its "150" 
		(assoc 370 enx) (= 50 (cdr (assoc 370 enx))); entity has assigned LWeight and its 0.50mm
	)
	(setq
		enx (subst (cons 8 "0existingMP") (assoc 8 enx) enx); change its layer to "0existingMP"
		enx (subst (cons 62 256) (assoc 62 enx) enx); change its color to "ByLayer"
	)
)
(if ; Should the above statements ignore "Layer 1"?, currently example: Red/lineweight 0.50mm on "Layer 1" will be moved to layer "0existing" and will change its color to "ByLayer"
	(and
		(assoc 62 enx) ; that has assigned index color
		(= "Layer 1" (cdr (assoc 8 enx))) ; Everything else on "Layer 1"
	)
	(setq
		enx (subst (cons 8 "0") (assoc 8 enx) enx); change its layer to "0"
		enx (subst (cons 62 256) (assoc 62 enx) enx); change its color to "ByLayer"
	)
)
(entupd (cdr (assoc -1 (entmod enx)))) ; modify (update) the entity
); repeat

You need to replace the whole "repeat" part on the last code with this one.

BTW do you sill want to erase the entities with cyan color?

 

I have tested the code and I don't think I have explained myself very well so I have attached a drawing. The original code below does everything I need apart from it moves the lineweight 0.50mm/color 151 to the '0existing' layer but I would ideally like them to move to '0existingMP'. Everything else is perfect & you will also see why deleting the cyan colors is required!

 

(defun C:test ( / lyr1 lyr0 acDoc emakeLay SSX i e enx ce )

(setq lyr1 "Layer 1");<- type your layername here
(setq lyr0 "0existing");<- type your layername for lineweight 0.50mm

(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-map-collection (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (x) (vla-put-Lock x :vlax-false)))
(defun emakeLay (nm)
	(or (tblsearch "LAYER" nm)
		(progn
			(alert (strcat "\nLayer \"" nm "\" does not exist, creating it!"))
			(entmakex (list (cons 0 "LAYER")(cons 100 "AcDbSymbolTableRecord")(cons 100 "AcDbLayerTableRecord")(cons 2 nm)(cons 70 0)))
		)
	)
	(princ)
); defun emakeLay
(mapcar 'emakeLay (list lyr0 lyr1))

(if (setq SSX (ssget "_X" (list (cons 410 (getvar 'ctab)))))
	(progn
		(setq ce (getvar 'cmdecho))
		(setvar 'cmdecho 0)
		(command "_.SCALE" SSX "" '(0. 0. 0.) 5)
		(repeat (setq i (sslength SSX))
			(setq e (ssname SSX (setq i (1- i))))
			(setq enx (entget e))
			(if (= lyr1 (cdr (assoc 8 enx)))
				(setq enx (subst (cons 8 "0") (assoc 8 enx) enx))
			)
			(if (= (cdr (assoc 62 enx)) 35)
				(setq 
					enx (subst (cons 8 "0") (assoc 8 enx) enx)
					enx (subst (cons 62 256) (assoc 62 enx) enx)
				)
			)
			(if (= (cdr (assoc 370 enx)) 50)
				(progn
					(if (and (assoc 62 enx) (/= (cdr (assoc 62 enx)) 4)) 
						(setq enx (subst (cons 62 256) (assoc 62 enx) enx))
					)
					(setq enx (subst (cons 8 lyr0) (assoc 8 enx) enx))
				)
			)
			(entupd (cdr (assoc -1 (entmod enx))))
			(if (= (cdr (assoc 62 enx)) 4)
				(entdel e)
			)
		)
		(vla-Regen acDoc acActiveViewport)
		(vla-ZoomExtents (vlax-get-acad-object))
		(if ce (setvar 'cmdecho ce))
	)
)
(princ)
);| defun |; (vl-load-com) (princ)

Edited by andy_06
Added drawing to test
  • 2 weeks later...
Posted
I have tested the code and I don't think I have explained myself very well so I have attached a drawing. The original code below does everything I need apart from it moves the lineweight 0.50mm/color 151 to the '0existing' layer but I would ideally like them to move to '0existingMP'. Everything else is perfect & you will also see why deleting the cyan colors is required!

 

(defun C:test ( / lyr1 lyr0 acDoc emakeLay SSX i e enx ce )

(setq lyr1 "Layer 1");<- type your layername here
(setq lyr0 "0existing");<- type your layername for lineweight 0.50mm

(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-map-collection (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (x) (vla-put-Lock x :vlax-false)))
(defun emakeLay (nm)
	(or (tblsearch "LAYER" nm)
		(progn
			(alert (strcat "\nLayer \"" nm "\" does not exist, creating it!"))
			(entmakex (list (cons 0 "LAYER")(cons 100 "AcDbSymbolTableRecord")(cons 100 "AcDbLayerTableRecord")(cons 2 nm)(cons 70 0)))
		)
	)
	(princ)
); defun emakeLay
(mapcar 'emakeLay (list lyr0 lyr1))

(if (setq SSX (ssget "_X" (list (cons 410 (getvar 'ctab)))))
	(progn
		(setq ce (getvar 'cmdecho))
		(setvar 'cmdecho 0)
		(command "_.SCALE" SSX "" '(0. 0. 0.) 5)
		(repeat (setq i (sslength SSX))
			(setq e (ssname SSX (setq i (1- i))))
			(setq enx (entget e))
			(if (= lyr1 (cdr (assoc 8 enx)))
				(setq enx (subst (cons 8 "0") (assoc 8 enx) enx))
			)
			(if (= (cdr (assoc 62 enx)) 35)
				(setq 
					enx (subst (cons 8 "0") (assoc 8 enx) enx)
					enx (subst (cons 62 256) (assoc 62 enx) enx)
				)
			)
			(if (= (cdr (assoc 370 enx)) 50)
				(progn
					(if (and (assoc 62 enx) (/= (cdr (assoc 62 enx)) 4)) 
						(setq enx (subst (cons 62 256) (assoc 62 enx) enx))
					)
					(setq enx (subst (cons 8 lyr0) (assoc 8 enx) enx))
				)
			)
			(entupd (cdr (assoc -1 (entmod enx))))
			(if (= (cdr (assoc 62 enx)) 4)
				(entdel e)
			)
		)
		(vla-Regen acDoc acActiveViewport)
		(vla-ZoomExtents (vlax-get-acad-object))
		(if ce (setvar 'cmdecho ce))
	)
)
(princ)
);| defun |; (vl-load-com) (princ)

 

Hi Grrr, have you been able to have a look at this one? Apologies for pestering you.

Posted
Hi Grrr, have you been able to have a look at this one? Apologies for pestering you.

 

The drawing you attached, contains 3 polylines and 3 mtext objects, where everything is on "0gas" layer.

Sorry but I don't see any connection between it and your request for modifying any objects who have custom assigned colors/lineweights.

Can't you already figure out how to do it by yourself with the numerous examples posted in this thread?

or maybe wait for someone else to respond (if he understood the task correctly).

Posted
The drawing you attached, contains 3 polylines and 3 mtext objects, where everything is on "0gas" layer.

Sorry but I don't see any connection between it and your request for modifying any objects who have custom assigned colors/lineweights.

Can't you already figure out how to do it by yourself with the numerous examples posted in this thread?

or maybe wait for someone else to respond (if he understood the task correctly).

 

Apologies I attached the wrong 'Test' file which I wasn't aware of.

I have tried figuring it out myself but I don't claim to be an expert so that is why I come here for help with more advanced coding like this.

No problem if you aren't able to help further as you have already done plenty.

Test.dwg

Posted (edited)

I have given this a go and made some progress. It almost does everything I would like but I would prefer it if when the new layers were created at the beginning they were set so that the layer color for "0gas MP" is blue and "0gas exist" is red and then the color of the lines can be set to 'By Layer'. The only way I have got it to work at the moment is to change the color of the lines. I hope this makes sense.

 

(defun C:test ( / lyr2 lyr1 lyr0 acDoc emakeLay SSX i e enx ce )

(setq lyr2 "0gas MP");<- type your layername here	
(setq lyr1 "Layer 1");<- type your layername here
(setq lyr0 "0gas exist");<- type your layername for lineweight 0.50mm

(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-map-collection (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (x) (vla-put-Lock x :vlax-false)))
(defun emakeLay (nm)
	(or (tblsearch "LAYER" nm)
		(progn
			(alert (strcat "\nLayer \"" nm "\" does not exist, creating it!"))
			(entmakex (list (cons 0 "LAYER")(cons 100 "AcDbSymbolTableRecord")(cons 100 "AcDbLayerTableRecord")(cons 2 nm)(cons 70 0)))
		)
	)
	(princ)
); defun emakeLay
(mapcar 'emakeLay (list lyr0 lyr1 lyr2))

(if (setq SSX (ssget "_X" (list (cons 410 (getvar 'ctab)))))
	(progn
		(setq ce (getvar 'cmdecho))
		(setvar 'cmdecho 0)
		(command "_.SCALE" SSX "" '(0. 0. 0.) 5)
		(repeat (setq i (sslength SSX))
			(setq e (ssname SSX (setq i (1- i))))
			(setq enx (entget e))
			(if (= lyr1 (cdr (assoc 8 enx)))
				(setq enx (subst (cons 8 "0") (assoc 8 enx) enx))
			)
			(if (= (cdr (assoc 62 enx)) 35)
				(setq 
					enx (subst (cons 8 "0") (assoc 8 enx) enx)
					enx (subst (cons 62 256) (assoc 62 enx) enx)
				)
			)
			(if (= (cdr (assoc 62 enx)) 151)
				(progn
					(if (and (assoc 62 enx) (/= (cdr (assoc 62 enx)) 5)) 
						(setq enx (subst (cons 62 5) (assoc 62 enx) enx))
					)
					(setq enx (subst (cons 8 lyr2) (assoc 8 enx) enx))
				)
			)

			(if (= (cdr (assoc 62 enx)) 1)
				(progn
					(if (and (assoc 62 enx) (/= (cdr (assoc 62 enx)) 1)) 
						(setq enx (subst (cons 62 256) (assoc 62 enx) enx))
					)
					(setq enx (subst (cons 8 lyr0) (assoc 8 enx) enx))
				)
			)
			(entupd (cdr (assoc -1 (entmod enx))))
			(if (= (cdr (assoc 62 enx)) 4)
				(entdel e)
			)
		)
		(vla-Regen acDoc acActiveViewport)
		(vla-ZoomExtents (vlax-get-acad-object))
		(if ce (setvar 'cmdecho ce))
	)
)
(princ)
);| defun |; (vl-load-com) (princ)

Edited by andy_06

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...