⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

Alkategóriák

  • No decscription available

    20 Témakörök
    462 Hozzászólások
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Help with loading performance using Sketchup C SDK.

    2
    0 Szavazatok
    2 Hozzászólások
    633 Megtekintések
    Dan RathbunD
    You can also ask your question at: http://forums.sketchup.com/c/developers/sketchup-sdk The SketchUp Team members are more likely to answer, more quickly.
  • Toolbar position

    6
    0 Szavazatok
    6 Hozzászólások
    798 Megtekintések
    bomastudioB
    A lot of things to study..... many thanks Dan....you are a GURU!!!
  • Deleting Component Instance

    5
    0 Szavazatok
    5 Hozzászólások
    981 Megtekintések
    bomastudioB
    Guys you are and invaluable support for SU developers.... a beer to all of you!!!
  • ComponentInstance Guid question

    12
    0 Szavazatok
    12 Hozzászólások
    2k Megtekintések
    thomthomT
    EntityID are unique for the model - but entities will be assigned a new ID each time you open it. They are not persistent. There will not be two entities with the same entityID in a model. ComponentDefinition GUIDs change as you modify the definition. ComponentInstance GUIDs persist - even if you edit the instance/definition.
  • Access specifies entity

    3
    0 Szavazatok
    3 Hozzászólások
    564 Megtekintések
    Dan RathbunD
    # Search top and 1st nested level for a named group; grps = Sketchup.active_model.active_entities.grep(Sketchup;;Group) if !grps.empty? found = grps.find {|grp| grp.name = "Target Name" } else found = nil end if !found # found will be nil, if group was not found nested = Sketchup.active_model.entities.find_all {|ent| ent.is_a?(Sketchup;;Group) || ent.is_a?(Sketchup;;ComponentInstance) } nested.each {|ent| ents = ent.is_a?(Sketchup;;Group) ? ent.entities ; ent.definition.entities grps = ents.grep(Sketchup;;Group) found = grps.find {|grp| grp.name = "Target Name" } if !grps.empty? } end # found will be the group reference, if it was found # found will be nil, if group was not found
  • Extract 3D information to regenerate the shape

    4
    0 Szavazatok
    4 Hozzászólások
    934 Megtekintések
    Dan RathbunD
    SketchUp is a surface modeler. Everything in SketchUp is basically made up of edges, vertices, and faces. There are no complex built-in 3D shape classes in the SketchUp Ruby API. Instead primitives are either grouped into Group class instances, or ComponentInstance class instances. (Each have a defining ComponentDefinition class instance.) These mentioned classes are all sub-classes of Entity, and inherit it's functionality (as well as the intermediate Drawingelement class functionality.) Any Entity subclass instance can have any number of AttributeDictionary instances attached to them. You can put whatever custom data you wish into attributes in a custom dictionary, usually named the same as your plugin. (Ex: "Ruts_Shaper_Properties") Back to the grouped 3D shape. Groups and components have a built-in definition name and each instance of them can have a separate more unique instance name. Group and component instances have built-in transformation property, from which you can query all the translational, rotational, scaling and axial subproperties. See the Geom::Transformation class. All Drawingelement subclasses (the objects that can be seen in the model,) have an invisible boundingbox, from which you can get the corners and the center. See the Geom::BoundingBox class. It would be more efficient to create the basic shapes as an external SKP component library, and insert them into the model, rather than draw each using code, but drawing them adhoc can be done. You should most likely install the SketchUp Team's example Shapes plugin, and study the code. http://extensions.sketchup.com/en/search/site/Shapes
  • Variable values in attribute dictionaries

    8
    0 Szavazatok
    8 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    @ssunderland said: ` n=0 i=0 Sketchup.active_model.selection[n].set_attribute("Bubble","id",i); n+=1; i+=1` You are missing some basic knowledge of Ruby. Most of the API collection classes have the library module Enumerable mixed into them. http://ruby-doc.org/core-2.0.0/Enumerable.html It is usually safer (to avoid fencepost errors, etc.) to use the built-in block form iterator methods. Sketchup.active_model.selection.each_with_index {|ent,idx| ent.set_attribute("SSU_Bubble","id",idx) } If you want to process in reverse order, make an array copy of the selection, using to_a and the Array#reverse method: Sketchup.active_model.selection.to_a.reverse.each_with_index {|ent,idx| ent.set_attribute("SSU_Bubble","id",idx) } However, there is one major rule. Do not delete collection members while iterating the collection. The loop will lose it's place, and strange results occur. In that case, always iterate an array copy of the collection, if your loop must remove or add collection members. This is most often seen while modifying Entities collections.
  • Saving all instance variables of an object

    14
    0 Szavazatok
    14 Hozzászólások
    2k Megtekintések
    A
    Bug posted in the GitHub Issues field!
  • Change color entity group

    3
    0 Szavazatok
    3 Hozzászólások
    667 Megtekintések
    Y
    Excelente! Thanks very much!
  • This tripped me up (again) today

    25
    0 Szavazatok
    25 Hozzászólások
    6k Megtekintések
    A
    Back to TIG's comment about plural vs. singular names for arrays, here is the way I'm naming things. In this context, the singular terms seem to work better for me, probably because I think of it as the mathematical notation P[sub:2dctu78y]0[/sub:2dctu78y], P[sub:2dctu78y]1[/sub:2dctu78y], ... P[sub:2dctu78y]N[/sub:2dctu78y]. =begin point[N] x-------------x point[0] angle[0] = angle_between vector[N], vector[0] vector[N] \ vector[N] = point[N], point[0] \ \ vector[0] \ vector[0] = point[0], point[1] \ x point[1] angle[1] = angle_between vector[0], vector[1] / vector[1] / vector[1] = point[1], point[2] / / / x point[2] angle[2] = angle_between vector[1], vector[2] =end
  • Access module variables from inside a module class

    2
    0 Szavazatok
    2 Hozzászólások
    457 Megtekintések
    Dan RathbunD
    "Programming Ruby - The Pragmatic Programmer's Guide" explains it all.
  • Webdialog - getting started?

    21
    0 Szavazatok
    21 Hozzászólások
    2k Megtekintések
    thomthomT
    I tried once more, and this time it's listed. (no idea why it wasn't earlier - but at least it's working now.) Very nice feature.
  • Importing don't have to bring inherit of lenz

    2
    0 Szavazatok
    2 Hozzászólások
    395 Megtekintések
    kimpastroK
    well.. that's embarrassing... actually the "problem" is that i had overloaded "onElementAdded" method.. and put: @service.recent_inherit! entity now i send a new attribute, then it becomes: if entity.definition.get_attribute 'dynamic_attributes', 'imported_entity' @service.recent_inherit! entity end sorry about that and thanks for your time. cheers.
  • Custom tool creating instances of text labels

    5
    0 Szavazatok
    5 Hozzászólások
    643 Megtekintések
    S
    @tig said: Here's how I would do it... Let's first assume that a component-instance has no label. The user clicks on it. It is confirmed as a component-instance. It is also checked for a special attribute, tid=instance.get_attribute("SensorNodeInfo", "tid", nil), in this case it returns nil as it has no label. unless tid > ### add_label_code > else > ### delete_label_code > end The 'add_label_code' will make the Text object, and give it a 'tid', a matching 'tid' will also be given to the picked instance... ` tid=Time.now.to_f+rand instance.set_attribute("SensorNodeInfo", "tid", tid) some code to add the Text object - referenced as 'label' label.set_attribute("SensorNodeInfo", "tid", tid)` Now the instance and its label are pair with a matching [unique] tid attribute. The 'delete_label_code' erases any related 'label', by matching its 'tid'. The 'label' Text object will have been previously given a unique 'tid' returned in the 'instance' match that was NOT nil, so you need to iterate the instances context to get possible candidates, labels_to_go=instance.parent.entities.grep(Sketcup::Text).select{|e| e.get_attribute("SensorNodeInfo", "tid", nil)==tid } then instance.parent.entities.erase_entities(labels_to_go) if labels_to_go[0] Thanks that's very helpful.
  • Ruby access to "hidden" v-ray materials

    2
    0 Szavazatok
    2 Hozzászólások
    479 Megtekintések
    dkendigD
    those don't sound like issues that were in the latest service release. The V-Ray material information is stored in the material's attribute dictionary in xml format. Multi-Materials have the child material xml included with them.
  • I wish to hire a developer

    10
    0 Szavazatok
    10 Hozzászólások
    1k Megtekintések
    dkendigD
    I know I'm late to the game, but I am just seeing this now. I am wrapping up development of another extension, and will be ready to take up my next project soon. Are you still looking for a developer to make this for you?
  • Need to hire developer for extension creation

    2
    0 Szavazatok
    2 Hozzászólások
    546 Megtekintések
    dkendigD
    I'm wrapping up development on another plugin, and will be available for my next project soon. Are you still looking for a developer to help you create this?
  • Which folders does SU look for gems in?

    3
    0 Szavazatok
    3 Hozzászólások
    822 Megtekintések
    S
    Thanks, I will test this and come back to post the results.
  • Ruby code for selecting Component Instances by name

    3
    0 Szavazatok
    3 Hozzászólások
    952 Megtekintések
    M
    Many thanks TIG, your first code line does perfectly the job. In fact I have many instances of the same component, and each one is differentiated by a unique name. And just by removing s.clear I can make multiple selections, which is exactly what I intended to do. You made my day !!
  • Move a Transformation.rotation object to x, y and z position

    7
    0 Szavazatok
    7 Hozzászólások
    869 Megtekintések
    kimpastroK
    @dan rathbun said: @kimpastro said: PS: don't know if i'm using the correct terms for elements like: model, entity, modules, etc. Sorry about that. Yes you are misusing the term module. In your examples, "loaded_module" is a "loaded_component_definition". module is a ruby keyword, and a block of code that forms a namespace. Thanks, I'll be careful next time. I'm confusing about module because we use the same term to determine the "master entity" of our projects to our clients.

Advertisement