Place Text Label script (looking for one)
-
Thanks TIG, sorry I left you off the list of people who have already thought about many of these things. (And sorry to all those other developers who participate in discussions like this who I left out as well)
What I was hoping to find was a tool, almost exactly like the SketchUp Text tool, so I could modify it to use a premade label rather than the Component name. I see your coods-tag tool does not do the two-point input, (unless I missed something)
Another we would like to do it to point to a component or group which already has a label and find its label, and/or point to a label and find the item it is attached to.
Does anyone have any insight into this. (I see that I move an object, the leader moves with it, so there must be some way to know which item is associated with which label)
-
My co-ords tool simply places the text at the picked point, with a fixed vector for the leader offset, BUT it'd be very straightforward to have your tool expect the user to pick two points - the first to set the 'arrow' insertion point [
point
] and the second [let's call itpoint2
] to set thevector
for the leader to the string itself...vector=point.vector_to(point2)
You'd just need to insert another state 'case' in the onClick parts, and set a second point from the second input point picked etc...To link two things like a component and its tag you need to use matching pairs of attributes - with enduring unique ids [I use a time stamp + rand].
To see how I've done this look at the Hole Punching tool. That gives the instance an attribute id and the reveals the equivalent attribute id code. It does more complex stuff that you want like watching if the user selects one of them so they all select as if grouped for a move etc... You need to write two tools - one where you pick the instance and it highlights its matching tag and the other where you pick the tag and it highlights its matching instance...One issue you will have is that when you place a text label manually it links to an object.
You cannot do that in code. A user can use the Text tool to edit the text and re-glue the arrow on the object but it's not code-able. The only complex work around would be to use observers [somewhat like the hole punch] that check if the instance is moved and then find the associated text tag and relocate the leader's arrow to suit [you might need to remember the text's initial position [relative to the instance?] using an attribute, then transform it with the instance's current location and then reset it after the move]. Your code would also need to get the string's vector and also readjust it so that the string stays in the same place in the model and the leader is adjusted to suit the new arrow location... -
I am looking for a rubyscript that will add a leader referencing the Description of a component rather than the name of a component?
or an option to choose, even betterplease let me know if this is possible? I am not a ruby developer so would not know how to do this.
-
Ditto what Pierre is saying. Id like to be able to add labels that show the definition name rather than the name (component definition rather than instance name) . Is this possible?
At the moment if I add a label to a component it only gives me the instance name rather than definition name. -
Has anyone perfected this script or made one similar? I model construction projects that require many labels and being able to display component information would avoid a lot of reentry of day a just for display purposes. Also, does anyone know how to get sketchup (and Layout) to display the parent component and not the children components. Seems sketchup and layout both display the child component which is not what I AM after.
thanks....rich
-
@iaddic said:
Also, does anyone know how to get sketchup (and Layout) to display the parent component and not the children components. Seems sketchup and layout both display the child component which is not what I AM after.
Not exactly sure what your asking...
... BUT, SketchUp has two ways of controlling visibility.
(1)
Entity
object visibility stateAll
Sketchup::Drawingelement
subclass objects have an individual visibility state property. This is set via thevisible=
orhidden=
instance setter methods. The current state is gotten via thevisible?
orhidden?
instance query methods(2)
Layer
visibility stateLayers in SketchUp are only really for display control. If child components are on a different layer than the parent component, the "child layer" can be hidden either manually via the Layer Manager dialog, or via the layer's
visible=
setter method.OK?
So either way, it would mean that ALL child component instances would be hidden in ALL parent component instances because the layer assignments, or object visibility states, are done in the component definition.
The only way around this, would be to use unique parent groups.
-
Hi Dan,
The topic was directed at labels...I am not trying to control the visibility of the graphical item but more specifically need to include text with the object. Trouble is Sketchup and Layout seem weak on displaying attributes we spend so much time incorporating into our models.
For example I have a main component made up of three sub components. I use this main component often and there may be 100 or so instances a model. Since the component sits in a unique position in the model I must tag it with a unique name so that it is identifiable and locate able in downstream work flows.
So the model contains all kinds of specific attribute information about this component including its location and name...
However, when I try to apply labels; which Layout touts as having the ability to label the components name, it displays the sub components name and not the main component name...
This means I get to manually enter labels to match each model instance in Layout...what a wast of time! the data is there we just can not display what we want. There are many threads on this subject and I am wondering why this is so difficult to achieve...or why it seems to be obviously missing in the first place...
Now unless I am missing something, which I may very well might be, I am trying to unleash the attributes used in creating a model to be usable in Layout...or alternately, apply the attribute labels in a model view and display that view in Layout...
Thanks...
-
@iaddic said:
The topic was directed at labels... There are many threads on this subject and I am wondering why this is so difficult to achieve...
Because the
Sketchup::Text
class is very rudimentary, and lacks API interfaces to things, such as:
(1) the objects that text callouts are attached to
(2) the text callouts that are attached to objects
(3) the font settings
(4) formula fields that can display attributes
(5) an update method on the text instanceWe've complained for years about this, and already requested these features.
BUT, it seems those "in charge" feel this is documentation, and want to push users over to doing this within Layout. (Ignoring the fact there are people who do not want to use Layout, and therefor need a more robust text callout feature in the SketchUp model space.)
-
Thanks Dan...hopefully this will improve because much of the model is data driven...what a shame. Thanks for informing me
-
@iaddic said:
Trouble is Sketchup and Layout seem weak on displaying attributes we spend so much time incorporating into our models. ...
However, when I try to apply labels; which Layout touts as having the ability to label the components name, it displays the sub components name and not the main component name...This means I get to manually enter labels to match each model instance in Layout...what a wast of time!
Sounds like a bug in Layout.
If it does not work the way you think it should, try posting a bug report:
http://forums.sketchup.com/category/layout -
Thanks Dan, I've submitted a bug report, we'll see what they say...I am still bemused by how locked out the meta data information is in both sketchup and layout...I sure hope they open it all up sometime soon.
Have a great weekend, Rich
-
There's a weird difference between v2014 and earlier versions... in SketchUp - and I suspect filtered down into Layout
In earlier SketchUp versions, if you add a Text label onto a 'container' it displays the name of that container's Instance, or if that is blank it shows the name of the container's Definition: if the main container includes other nested containers, then you need to place Text labels for those within the main container itself - whatever you click onto in the main container the Text label always relates directly to it, NOT its contents.
In SketchUp v2014, if you add a Text label onto a 'container' it displays the name of that container's Instance, or if that is blank it shows the name of the container's Definition: BUT if the main container includes other nested containers, then when you add the Text label onto the outside of the main container it will display the 'name' of that nested element instead - and if the main container only contains nested containers you'll always get the 'names' of those - never the container itself, so in that case you cannot label using the name of the main container ! - however, if the main container also includes some raw geometry then clicking onto that will add the name of the main container again.
So to recap:
In earlier SketchUp versions any Text label added onto a 'container' only ever displays that container's 'name'.
But in SketchUp v2014, whilst a similar Text label will still display the container's 'name', this occurs only if the clicked entity is 'geometry' - if the clicked entity is another nested container then the Text label shows the name of that nested container instead: thus if the main container includes only nested containers it is now no longer possible to add a Text label showing its name, because the nested names always take precedence ! -
TIG - Amazing that you knew this...I just received feedback from Sketchup after submitting a Bug report as Dan suggested...they felt it was a bug in version 2014...so I tried what you said and added some geometry to my component and just as you said: the label contains the name of the component as expected.
So first thanks for chiming in...I've been all over for weeks looking for a solution/alternative to get my labels to display the the main component.
Secondly, the convention you describe carries over into Layout so it would seem it is that way by design.
Thanks Again, Rich
-
I don't think it's intentional !
You really ought to be able to label a component OR its nested instances - even if it's wholly made from nested instances.
A simple solution would be to add a modifier key to the Text tool, so if you pick a point for some Text whilst holding down Shift it then always displays the top-level container, otherwise it says the nested part's name OR the main container name IF the clicked-on object is raw-geometry or an unnamed-group. -
If you do not need primitives in the main container, then a construction point could give you something to "point to". Later the layer of the construction point could be hidden.
-
Hi everyone,
Like the users ask to Al Hart, I me too want to place a text label in the drawing, using the value of an Attribute on the entity for the text. To be more specific I downlaod a dynamic door compoenent wich is really cool and offer me lot of options, but I really want to have the name of the compomenet and the its length and height to be shown at the bottom of the door for example or eles where in order to view this information when I produce de plan view in layout. I know I can a samrt lable in Layout to do that wich I am doing right now. But I really want to have this implemented in the compoenent so the infomrations is update upon the dynamic compoenent attribute. Because right now, we often miss a door when inserting samrt lable in LAYOUT. It's a hard job to get focus and not mis a door in LAYOUT when we have like 100 doors in our drawing.
Thanks in advance for your answer.
Advertisement