| Author |
Message |
Joe Burke
Guest
|
Posted:
Tue Apr 05, 2005 6:58 pm Post subject:
update layer color in documents collection |
|
|
All,
Using 2004. The following is driving me slightly crazy.
Assuming I have two files open and both have objects on layer zero color bylayer.
Layer zero is just an example.
This "test" function changes the color of layer zero in all files contained in the
documents collection.
(defun c:test ( / documents clrnum layers )
(setq documents (vla-get-documents (vlax-get-acad-object)))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
)
)
OK so far. The color of layer zero is changed in all open files. But I only see the
layer color update in the active file. Switching to the other open file does not
reflect the updated layer zero color. Regen or regenall does not update the color of
objects on layer zero in the other open file. Though the layer color is in fact
changed.
What does update objects on layer zero (in the other open file) is simply picking the
layer toolbar dropdown menu or opening Layer Manager without any changes.
Any thoughts regarding what's going on here would be welcome.
Thanks
Joe Burke
|
|
| Back to top |
|
 |
Jason Piercey
Guest
|
Posted:
Tue Apr 05, 2005 7:09 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi Joe,
Dives me crazy also, and it is not just layer zero.
Noticed this the other day when penning a quick
and dirty function to match up some layer colors
from an open file. Using 2005 here.
--
Autodesk Discussion Group Facilitator
"Joe Burke" <joburke@hawaii.rr.com> wrote in message
news:4252a7b5_3@newsprd01...
| Quote: | All,
Using 2004. The following is driving me slightly crazy.
Assuming I have two files open and both have objects on layer zero color
bylayer.
Layer zero is just an example.
This "test" function changes the color of layer zero in all files
contained in the
documents collection.
(defun c:test ( / documents clrnum layers )
(setq documents (vla-get-documents (vlax-get-acad-object)))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
)
)
OK so far. The color of layer zero is changed in all open files. But I
only see the
layer color update in the active file. Switching to the other open file
does not
reflect the updated layer zero color. Regen or regenall does not update
the color of
objects on layer zero in the other open file. Though the layer color is in
fact
changed.
What does update objects on layer zero (in the other open file) is simply
picking the
layer toolbar dropdown menu or opening Layer Manager without any changes.
Any thoughts regarding what's going on here would be welcome.
Thanks
Joe Burke
|
|
|
| Back to top |
|
 |
Joe Burke
Guest
|
Posted:
Tue Apr 05, 2005 7:25 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi Jason,
It's nice to know I'm not alone in this quandary. :-)
I only used layer zero as an example so the demo code would work given any set of
files. Agreed, the issue isn't limited to layer zero.
Regards
Joe
| Quote: | Hi Joe,
Dives me crazy also, and it is not just layer zero.
Noticed this the other day when penning a quick
and dirty function to match up some layer colors
from an open file. Using 2005 here.
--
Autodesk Discussion Group Facilitator |
|
|
| Back to top |
|
 |
Luis Esquivel
Guest
|
Posted:
Tue Apr 05, 2005 7:49 pm Post subject:
Re: update layer color in documents collection |
|
|
Joe and Jason,
See if that works.
(defun c:test ( / documents clrnum layers )
(setq documents (vla-get-documents (vlax-get-acad-object)))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
(vla-save x)
)
)
LE. |
|
| Back to top |
|
 |
Jason Piercey
Guest
|
Posted:
Tue Apr 05, 2005 8:20 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi Luis,
I'll have to test that out later, work is getting in the
way of everything right now.
--
Autodesk Discussion Group Facilitator
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252b36c$1_3@newsprd01...
| Quote: | Joe and Jason,
See if that works.
(defun c:test ( / documents clrnum layers )
(setq documents (vla-get-documents (vlax-get-acad-object)))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
(vla-save x)
)
)
LE.
|
|
|
| Back to top |
|
 |
Joe Burke
Guest
|
Posted:
Tue Apr 05, 2005 8:23 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi Luis,
Adding (vla-save x) doesn't seem to make a difference.
And of course I wouldn't want to be forced to such a solution, since I go out of my
way to not to save open documents when dealing with a mix of ODBX documents and docs
in the documents collection. An issue I didn't mention previously, though in play
given the bigger picture.
Regards
Joe Burke
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252b36c$1_3@newsprd01...
| Quote: | Joe and Jason,
See if that works.
(defun c:test ( / documents clrnum layers )
(setq documents (vla-get-documents (vlax-get-acad-object)))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
(vla-save x)
)
)
LE.
|
|
|
| Back to top |
|
 |
Luis Esquivel
Guest
|
Posted:
Tue Apr 05, 2005 8:24 pm Post subject:
Re: update layer color in documents collection |
|
|
| Quote: | I'll have to test that out later, work is getting in the
way of everything right now.
|
Okay, if you guys need help or have a Janitor position, let me know..... :-)
LE. |
|
| Back to top |
|
 |
Luis Esquivel
Guest
|
Posted:
Tue Apr 05, 2005 8:28 pm Post subject:
Re: update layer color in documents collection |
|
|
Is working here Joe at least on all the tests I did on acad 2005...
| Quote: | And of course I wouldn't want to be forced to such a solution, since I go
out of my
way to not to save open documents when dealing with a mix of ODBX
documents and docs
in the documents collection. An issue I didn't mention previously, though
in play
given the bigger picture. |
|
|
| Back to top |
|
 |
Luis Esquivel
Guest
|
Posted:
Tue Apr 05, 2005 8:51 pm Post subject:
Re: update layer color in documents collection |
|
|
Sorry Joe,
I closed and re open autocad, and now what I was doing does not work.....
very strange....
LE.
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252bf04$1_3@newsprd01...
| Quote: | Is working here Joe at least on all the tests I did on acad 2005...
And of course I wouldn't want to be forced to such a solution, since I
go
out of my
way to not to save open documents when dealing with a mix of ODBX
documents and docs
in the documents collection. An issue I didn't mention previously,
though
in play
given the bigger picture.
|
|
|
| Back to top |
|
 |
Luis Esquivel
Guest
|
Posted:
Tue Apr 05, 2005 9:00 pm Post subject:
Re: update layer color in documents collection |
|
|
ok.... I did the test with two drawings again....
1. I open two dwgs
2 I did the color change with your code on the active dwg
3. I open the other drawing and the color is not updated
4. went I go to the other drawing and manually click on the qsave, the color
is updated
5. if I go back to the previous dwg and call your routine and change the
color, now both dwgs are updated.
hope that makes some sense... even if not works for you....
LE.
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252c200$1_2@newsprd01...
| Quote: | Sorry Joe,
I closed and re open autocad, and now what I was doing does not work.....
very strange....
LE.
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252bf04$1_3@newsprd01...
Is working here Joe at least on all the tests I did on acad 2005...
And of course I wouldn't want to be forced to such a solution, since I
go
out of my
way to not to save open documents when dealing with a mix of ODBX
documents and docs
in the documents collection. An issue I didn't mention previously,
though
in play
given the bigger picture.
|
|
|
| Back to top |
|
 |
Joe Burke
Guest
|
Posted:
Wed Apr 06, 2005 2:19 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi Luis,
Thanks for trying. I understand what you mean, but it doesn't work that way under
2004.
I also tried releasing the "layers" object inside the vlax-for function. No help.
Strange....
Joe Burke
| Quote: | ok.... I did the test with two drawings again....
1. I open two dwgs
2 I did the color change with your code on the active dwg
3. I open the other drawing and the color is not updated
4. went I go to the other drawing and manually click on the qsave, the color
is updated
5. if I go back to the previous dwg and call your routine and change the
color, now both dwgs are updated.
hope that makes some sense... even if not works for you....
LE.
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252c200$1_2@newsprd01...
Sorry Joe,
I closed and re open autocad, and now what I was doing does not work.....
very strange....
LE.
"Luis Esquivel" <nospam@address.withheld> wrote in message
news:4252bf04$1_3@newsprd01...
Is working here Joe at least on all the tests I did on acad 2005...
And of course I wouldn't want to be forced to such a solution, since I
go
out of my
way to not to save open documents when dealing with a mix of ODBX
documents and docs
in the documents collection. An issue I didn't mention previously,
though
in play
given the bigger picture.
|
|
|
| Back to top |
|
 |
James Allen
Guest
|
Posted:
Wed Apr 06, 2005 4:54 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi Joe, just taking a shot here that I haven't noticed mention of yet.
Perhaps adding (vla-Update AcadObject) would help? Luis recently introduced
me to this and it has been helpful, though I am still at a loss how to know
when it needs to be used.
Also, does it make any difference to use the TrueColor property rather than
Color? I expect not, but perhaps worth a try. Regardless, I remember
someone mentioning that the Color prop will cease to be supported.
--
James Allen, EIT
Malicoat-Winslow Engineers, P.C.
Columbia, MO
"Joe Burke" <joburke@hawaii.rr.com> wrote in message
news:4252a7b5_3@newsprd01...
| Quote: | All,
Using 2004. The following is driving me slightly crazy.
Assuming I have two files open and both have objects on layer zero color
bylayer.
Layer zero is just an example.
This "test" function changes the color of layer zero in all files
contained in the
documents collection.
(defun c:test ( / documents clrnum layers )
(setq documents (vla-get-documents (vlax-get-acad-object)))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
)
)
OK so far. The color of layer zero is changed in all open files. But I
only see the
layer color update in the active file. Switching to the other open file
does not
reflect the updated layer zero color. Regen or regenall does not update
the color of
objects on layer zero in the other open file. Though the layer color is in
fact
changed.
What does update objects on layer zero (in the other open file) is simply
picking the
layer toolbar dropdown menu or opening Layer Manager without any changes.
Any thoughts regarding what's going on here would be welcome.
Thanks
Joe Burke
|
|
|
| Back to top |
|
 |
Joe Burke
Guest
|
Posted:
Wed Apr 06, 2005 6:37 pm Post subject:
Re: update layer color in documents collection |
|
|
Hi James,
That's an interesting idea. Unfortunately it doesn't seem to solve the problem.
Here's a revised "test" function which incorporates the idea as I understand it.
(defun c:test ( / *acad* documents clrnum layers )
(setq *acad* (vlax-get-acad-object))
(setq documents (vla-get-documents *acad*))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
;(vlax-release-object layers) ;doesn't help
;(vla-update *acad*) ;here
)
(vla-update *acad*) ;or here
(princ)
)
Regardless, I'm curious about the application of (vla-update AcadObject). When,
where, and to what purpose? I must have missed Luis speaking on this topic.
I'll try using TrueColor, but I also expect not. Right, the Color property will be
phased out. I wonder, is it still supported under 2006?
Regards,
Joe Burke
| Quote: | Hi Joe, just taking a shot here that I haven't noticed mention of yet.
Perhaps adding (vla-Update AcadObject) would help? Luis recently introduced
me to this and it has been helpful, though I am still at a loss how to know
when it needs to be used.
Also, does it make any difference to use the TrueColor property rather than
Color? I expect not, but perhaps worth a try. Regardless, I remember
someone mentioning that the Color prop will cease to be supported.
--
James Allen, EIT
Malicoat-Winslow Engineers, P.C.
Columbia, MO |
|
|
| Back to top |
|
 |
James Allen
Guest
|
Posted:
Wed Apr 06, 2005 10:10 pm Post subject:
Re: update layer color in documents collection |
|
|
vla-Update:
Here's the context:
http://discussion.autodesk.com/thread.jspa?messageID=4226890
In that particular case, it seemed to help the problem but in the end didn't
entirely resolve it.
Color:
When I get into 2k6 I'll let you know, if someone else doesn't first.
James
"Joe Burke" <joburke@hawaii.rr.com> wrote in message
news:4253f462$1_3@newsprd01...
| Quote: | Hi James,
That's an interesting idea. Unfortunately it doesn't seem to solve the
problem.
Here's a revised "test" function which incorporates the idea as I
understand it.
(defun c:test ( / *acad* documents clrnum layers )
(setq *acad* (vlax-get-acad-object))
(setq documents (vla-get-documents *acad*))
(initget 7)
(setq clrnum (getint "\nEnter layer zero color number: "))
(vlax-for x documents
(setq layers (vla-get-layers x))
(vlax-put (vla-item layers "0") 'Color clrnum)
;(vlax-release-object layers) ;doesn't help
;(vla-update *acad*) ;here
)
(vla-update *acad*) ;or here
(princ)
)
Regardless, I'm curious about the application of (vla-update AcadObject).
When,
where, and to what purpose? I must have missed Luis speaking on this
topic.
I'll try using TrueColor, but I also expect not. Right, the Color property
will be
phased out. I wonder, is it still supported under 2006?
Regards,
Joe Burke |
|
|
| Back to top |
|
 |
Joe Burke
Guest
|
Posted:
Thu Apr 07, 2005 3:16 pm Post subject:
Re: update layer color in documents collection |
|
|
James,
Oh, that thread... another flying saucer. :-)
Joe
|
|
| Back to top |
|
 |
|
|
|
|