James, also thx for the feedback
Posts made by Pout
-
RE: Change one instance of a component
-
RE: Change one instance of a component
ok thats sounds perfect.
but as you can imagine, if you want to do this seperately for each column you would have a huge amount of layers and a list next to your pc when you need to hide/unhide what layer in what scene.The fact a instance should be red or in it's original color is based upon a result of a script.
So all instances should have the possibility to become red or not...That's why we came up with the 'red version of a component' idea. If we could swap the link between instance and component based upon the script result we have a solid method to use without having to play with layers/scenes etc.
-
RE: Change one instance of a component
i'll try to give a 'written' concrete example:
An apartement building. All columns are based upon the same component.
Now i want one instance (column) to recieve a different color. Temporary, for analysing purposes.
I don't want it to become a unique component or what so ever. When i hit a button it should be in it's original color again.Now when the individual elements in the component did not get a color/material before the component was created there is no problem. I can change the color/material just of that instance to red. The others stay how they were.
But, when the individual elements in the component did get a color/material before the component was created there is a problem. To change the color of the column i want i need to go into the component and edit. This results in all instances (all columns) turning red.
To solve this problem we were thinking about copying the component and making it unique and give it the color red. This has no influence, we just created a new component(column) with the same characteristics as the others except it is red.
Now if we could define that, temporary, the column we want to be in red is an instance of the newly created component the problem is solved. Then this column is not anymore an instance of the original, colorless component but an instance of the new red component.
Later (after hitting the button) this column should become an instance of the original, colorless component again.That's the theory. We now just need to know how we can alter (in code/ruby) that that specific column is now an instance of the red column component and then an instance of the original colourless component.
I hope i make sense, as always i have it in my head but writing it down is harder.
Off course i can imagine there are other , better ways to do this. So if you have an idea, please let me know.thx again
-
RE: Change one instance of a component
well what we are looking for is this:
Somewhere there has to be defined that an instance is based upon a component. You can see that name in Entity info.
Now for example
We have 3 boxes which are instances of the same component.
Now we copy one of those boxes and make it a new component with the color red.
So we now still have 3 instances from the same component and one other, new component/instance who is exactly the same except color/material.Let's say that we want to make one of the 3 instances an instance of the copied component. So, we would like to edit the component-link information.
That way in the end we would have 2 instances from the basic component and 2 instances of the copied component.The question is: where is it defined on what component an instance is based and can this be edited.
Instance A--> base is component A
Instance B--> base is component AInstance C--> base is component B
Instance D--> base is component BWhere are those links defined and are they available for editting?
btw thanks alot for helping me on this
-
RE: Change one instance of a component
thanks again
so in that case you:
- edit an instance so that it has no color/material definition
- this results in all other linked instances to also lose their color/material definition
- recolor the instances but instead of on entity level, do it on component level.
What about the solution we were thinking about, can we somewhere edit the component linking so we can set another component as the basic component?
-
RE: Change one instance of a component
ok thank you, i indeed see possibilities here.
Now it off course all depends if the creator of the drawing attached colors/materials before making it a component or after...If he defined them bore making a component i cannot change them without de-linking?
-
RE: Change one instance of a component
thx Gaieus.
I see you mention colour/material. So does this mean i can change the color of one instance of a component without touching the link with the component?
The other method you descibe is to defficult to use.
The color changing is based upon a calculation and is only temporary in a certain mode we created in SU. So saving the component externally is not really an option. We would like to keep the original drawing as untouched as possible. -
Change one instance of a component
This is the problem we face:
We have a model with a component and several instances.
Now we want to be able to change the appearance of one instance without changing the others.
But the 'link' between the component and the instance must be maintained.We were thinking of creating a temporary copy of the original component and refer the instance that needs another appereance to that temp. component. We can put it then back to the original component later.
We face 2 problems with this theory:- This can only be done of a component itself is not present in the drawing, only the instances, otherwise the temporary copy would also be visible in the model.
- We can't find where the link between the instance and the component is defined so we can change that link.
At this moment this is what we are thinking about. But maybe there are better ways to do this.
In short:
How can i temporary make the appereance of an instance different then the other instances of the same component. Without losing the link towards the original component.( I hope i make sense!)
regards and thanks -
Script check-->materials
This is my script:
ss.each{|e| mat= e.get_attribute 'xdid_dict', 'sumatdisplay' if not mat UI.messagebox("no material specs in dict.") if e.material.display_name UI.messagebox("has a material") else UI.messagebox("has no material") end end }
What i want it to do is:
A. See if the selected object already has dictionary attributes defined:ss.each{|e| mat= e.get_attribute 'xdid_dict', 'sumatdisplay' if not mat UI.messagebox("no material specs in dict.")
These values are written in an earlier stage after some command is executed (this command writes the folowing values:
orig_name=e.material.name orig_materialtype=e.material.materialType orig_display_name=e.material.display_name orig_texture=e.material.texture orig_color=e.material.color orig_alpha=e.material.alpha e.set_attribute 'xdid_dict', 'sumatname', orig_name e.set_attribute 'xdid_dict', 'sumattype', orig_materialtype e.set_attribute 'xdid_dict', 'sumatdisplay', orig_display_name e.set_attribute 'xdid_dict', 'sumattexture', orig_texture e.set_attribute 'xdid_dict', 'sumatcolor', orig_color e.set_attribute 'xdid_dict', 'sumatalpha', orig_alpha
)
Question: Isn't it just possible to get the ID of the material the object has? Instead of the need to keep all these seperate variables?B. Now i have noticed that fresh created objects who have no material attached do not have any material values (how does SU stores their color-visual representation?). So i check these:
if e.material.display_name UI.messagebox("has a material") else UI.messagebox("has no material") end
This does not work. If there is no material assigned, then the script stops and does not sign "has no material". If there is a material assigned then the message "has a material" shows up ok.
Now maybe i'm a bit on the wrong path here, so i'll try to explain what i try to do:
Store the material-color (the visual part of an entity-group-...) in an attribute dictionary.
So when i do changes to them then i can get the original back.
It would be great if each material in SU had an ID and each object had this ID so i just have to store that one in the attribute dict.Thanks!!
-
RE: Add an object to the selection based on a attrib.
Excellent,
Thank you very much!Also, could you point me out a good book for ruby for SU?
i have this one book here now 'Learning Ruby' from O'reilly but it doesn't seem to contain the info i need.Regards,
-
Add an object to the selection based on a attrib.
Hello all,
In the attribute dictionary of all my objects in the model i have added a unique identifier for each object (since i have noticed that the ID's created by SU itself are not solid over several sessions)
Now if i want to add an entity-group-whatever with a specific unique id to the selection (so it shows selectedin SU) do I need to loop through all the available objects in SU?
Or is it possble to directly get that object and add it to the selection? (like:
object= select where ent.get_attribute "attrdict", "attrname" = xxx
selection_add objectThx again
-
RE: Drawingelement.material and face.back_material? [SOLVED]
This is how i do it:
I create a face with 4 edges. I select the face
Ruby console:
model=Sketchup.active_model
select=model.selectionIf i then execute the command:
status=select.material="Material1"
Error: #<NoMethodError: (eval):149: undefined methodmaterial=' for #<Sketchup::Selection:0x474fe88>> (eval):149* if I do this command: *status=select[0].back_material="Material1" Material1 **--> SO THIS IS OK** status=select[1].back_material="Material1" Error: #<NoMethodError: (eval):149: undefined method
back_material=' for nil:NilClass>
(eval):149Now today when i try this command:
status=select.back_material="Material1"
Error: #<NoMethodError: (eval):149: undefined method `back_material=' for #Sketchup::Selection:0x474fe88>
(eval):149I don't get it anymore
How can i give all selected objects a certain color/material? -
Drawingelement.material and face.back_material? [SOLVED]
I just did some tests on a simple face with 4 edges.
If I use this command (select=the face):
status=select[0].material="Material1" (drawingelement class)
then the back side of the face gets material 1and if i use this command:
status=select.back_material="Material1" (face class)
then the front side of the face gets material 1Why is this? And why are these commands seperated over 2 classes?
And is there any possibility to give a complete selection a certain material at once? (wether it is a combination of lines and faces or a group)Thx again.
Regards -
RE: Some possibility-questions on ruby and sketchup
can i get the center with point = boundingbox.center ?
-
RE: Some possibility-questions on ruby and sketchup
cyin6,
Great! Both do exactly what i need them to do.
Regarding the entities.add_text. I would like to place the text on the axis of an object.
I know how to specify the coordinates where the text must be placed, but i can't find how to get the axis of an Sketchup object, so i can use those coordinates.Also is it possible to do an action when the mouse is over an object? The entityObserver only seems to cover Erase and Change
Thx again
(any clue on the automatic generation of a page for each Scene en SU Layout?) -
Some possibility-questions on ruby and sketchup
Since they pointed me here in het newbie forum...here it goes
To get started i have some questions:
-
Is it possible to create scenes based upon external data?
ex.
I have a dbase with in it a list of names.
For each name i want to autmatically create a scene with that name.
Can this be done?
And in the same way: Is it possible to automatically create 1 page for each scene in Layout? -
Is it possible to display entity info in some sort of window while mousing over an object? Again this info is stored in a dbase. --> SOLVED, i think this can be done with webdialog.
-
Can colors of an object be different between scenes? Currently it's not in the list of the property-settings that are stored between scenes. --> I have seen that the position of objects can be stored between 2 scenes (proper animation script)
-
Is it possible to display text in the SU window that comes from out of SU? (eg. from a dbase or a txt file)
I hope these questions make sense and my english is understandable. I'm not looking for a complete script (but if it exsists, why not) but more guidelines on how to do the SU part. I think i already have the communication with the dbase working so now i just need some ruby advise on how to make it work in SU.
Thx in advance and kind regards,
Pout -
-
RE: A Welcome Message to New SketchUcation Members
Hello all,
While searching for sketchup info I found this active board, which i hope i can learn from on contribute to.
To get started i have some questions:
-
Is it possible to create scenes based upon external data?
ex.
I have a dbase with in it a list of names.
For each name i want to autmatically create a scene with that name.
Can this be done?
And in the same way: Is it possible to create 1 page for each scene in Layout? -
Is it possible to display entity info in some sort of window while mousing over an object? Again this info is stored in a dbase.
-
Can colors of an object be different between scenes? Currently it's not in the list of the property-settings that are stored between scenes.
-
Is it possible to display text in the SU window that comes from out of SU? (eg. from a dbase or a txt file)
I hope these questions make sense and my english is understandable. I'm not looking for a complete script (but if it exsists, why not) but more guidelines on how to do the SU part. I think i already have the communication with the dbase working so now i just need some ruby advise on how to make it work in SU.
Thx in advance and kind regards,
Pout -