Jump to content

Recommended Posts

Posted

(setq 3dsolid ss);if object is solid

(princ "\nHow will I do this?") ;;;

 

Can't you just use the "chprop" "C" colournumber ""

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    14

  • totzky

    7

  • gazzalp

    4

  • Baber62

    3

Posted

Thanks for your time Lee.Honestly, I'm not even using this kind of LISP.

I am more inclined to use changeprop or the properties dialogue.

I don't really want to insist on my issue, that is, to call some attention on what I found out.It's enough that I have satisfy my beginner's curiosity for now. Maybe in time I will be able to figure it out.

Posted
Maybe in time I will be able to figure it out.

 

Maybe I'm missing the point, but why wont the supplied LISPs work for 3DSolids?

Posted
Maybe I'm missing the point, but why wont the supplied LISPs work for 3DSolids?

 

Apologies, Lee Mac and CarlB. I might have confused myself trying to figure out why I keep getting an error when I'm using your code changing the color to "0" or "256".

I should have written "BYlayer" or "ByBlock.

Posted

No probs Totzky, we all make mistakes - after all, we're only human (with the exception of Remark)

Posted

CarlB's code should look something like this:

 

(defun c:0 ()
  (if 
     (setq p1 (cadr (ssgetfirst)))
     (progn 
   (sssetfirst) 
   (command "chprop" p1 "" "C" "ByBlock" "")
              )
  )
   (princ)
)

Posted
No probs Totzky, we all make mistakes - after all, we're only human (with the exception of Remark)

 

Hahaha and ha!!!

 

Good day to you Lee!

Posted

Just as a side note, one can use colours 0, and 256 for substituting into DXF group codes to set the colour (62) to byBlock and byLayer:

 

i.e.

 

(defun c:0 (/ ent eList)
 (while (setq ent (car (entsel "\nSelect Objects > ")))
   (setq eList (entget ent))
   (if (assoc 62 eList)
     (setq eList (subst (cons 62 0)(assoc 62 eList) eList))
     (setq eList (append eList (list (cons 62 0)))))
   (entmod eList))
 (princ))

 

And for By Layer:

 

(defun c:256 (/ ent eList)
 (while (setq ent (car (entsel "\nSelect Objects > ")))
   (setq eList (entget ent))
   (if (assoc 62 eList)
     (setq eList (subst (cons 62 256)(assoc 62 eList) eList))
     (setq eList (append eList (list (cons 62 256)))))
   (entmod eList))
 (princ))

  • 3 years later...
Posted

@ Lee Mac,

 

Always a source of knowledge.

 

I cam across this routine (http://cadtips.cadalyst.com/layer-properties/change-xref-layer-colors-quickly) which changes the xref colours. However, it does so by only allowing the user to select a single x-ref at a time. I would be grateful if this could be adapted to allow the user to chose multiple x-references in the same drawing. The coding is as below I have changed it so the x-reference colour changes to white (no. 7).

 

 

(defun C:XR7 (/ EN L X)
(setq   EN (nentsel "\nSelect Xref: ")    L (cdr (assoc 8 (entget (car EN))))   X (substr L 1 (vl-string-position (ascii "|") L)) )
(if  (/= (vl-string-search "|" L) nil)
 (progn
  (vlax-for layer (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))
   (if (/= (vl-string-search (strcat  X "|") (vla-get-name layer)) nil)(vla-put-Color layer 7))
  )
  (command ".REGEN")
  )
  (alert "Not an Xref!")
)
(prin1)
)

Posted

The code you have posted is changing the colour of the layer of a single object within a selected XRef, not the colour of the XRef itself.

 

Multiple selection (such as window selection) of nested objects is not possible using the standard selection methods, however, if you are instead looking to change the layer colour for all XRef layers of a selected XRef, the program could allow multiple XRef selection since there needn't be a distinction as to which subentity is to be modified.

Posted

Lee,

 

So the coding above only changes the x-ref colour for that particular drawing and does not change the x-ref itself. So to change the x-ref itself both bylayer and byblock it would require the two routines that you have posted earlier? Would it be possible to combine those two routines into one and allow the user to select multiple x-refs?

 

As I have a drawing with about 20 TQ tiles and it gets tiresome opening them individually, changing the colour for all layers to white and saving them back again. Any help would be appreciated.

Posted
So the coding above only changes the x-ref colour for that particular drawing and does not change the x-ref itself.

 

No, the program you have posted is changing the properties of the XRef-dependent layers in the drawing in which the XRef is inserted, it makes no changes to the XRef source drawing. Whether such changes are retained after the drawing is closed will be dependent on the setting of your VISRETAIN System Variable.

 

As I have a drawing with about 20 TQ tiles and it gets tiresome opening them individually, changing the colour for all layers to white and saving them back again. Any help would be appreciated.

 

You needn't modify the original XRef source file. Depending on the behaviour you are looking to obtain, you can alter the XRef-dependent layers in the drawing referencing the XRef, however, be aware of the VISRETAIN System Variable, as stated above.

Posted

Thanks Lee appreciate your time in educating me :D

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...