ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • May I know how to use "close_active" from the Model Class,pl

    2
    0 Votes
    2 Posts
    7k Views
    TIGT
    Sketchup.active_model.close_active will close a group or component that you have open for editing, and return to the base model, or group/component if the group being edited is 'nested' inside others. It returns 'true' if successful. It will return 'false' if you are in the base model itself as there's nothing to 'close'... TIG
  • Working with selection - ungrouped or within a group

    4
    0 Votes
    4 Posts
    8k Views
    Didier BurD
    Yes it is doable. For instance: def editing_group? if Sketchup.active_model.active_entities.parent.class == Sketchup::ComponentDefinition and Sketchup.active_model.active_entities.parent.group? return true else return false end Will return a boolean to tell the script if the user is currently editing a group. BUT using methods of the selection class is independant of that. Even if the user is editing a group, Sketchup.active_model.entities can be accessed the usual way, and Sketchup.active_model.active_entities will return a collection of entities of the active group/component. If you have to check wether selection is a group or not, use this test: Sketchup.active_model.active_entities.parent.class == Sketchup::ComponentDefinition (because group are stored as if they are components !) and if you have to check wether a particular selected object is part of a group or not, use this test: if editing_group? and Sketchup.active_model.active_entities.include?( object_id ) ... Hope this helps,
  • Outliner to Text?

    11
    0 Votes
    11 Posts
    10k Views
    S
    Thinking about this last night, combining some of my own work with things downloaded from the 3D warehouse, I came up with another feature which would be very useful. If you could show the number of faces at each level or the amount of memory used, you could tell where the most inefficient parts of your drawing are so that you could speed things up. I have no idea how to do that, or even if it's possible, but it's an idea.
  • Launching non-blocking external applications

    6
    0 Votes
    6 Posts
    10k Views
    T
    Interesting solution Azuby. I have to check how if it allows to pass parameters as well. Thanks Tomasz
  • Absolute vs. Relative Meshes/Groups

    2
    0 Votes
    2 Posts
    9k Views
    K
    Huh. Well. As it happens, it was much less painful adding in the transformation information than I thought: it works perfectly now. For anyone interested, just as an fyi, if you want to recapture the correct geometry, you have to transform the mesh according to the value returned by Group.transform, not the inverse of Group.transform. In other words, you want something like: t_matrix = Geom;;Tranformation.new def output_entity(entity, t_matrix) if entity.typename == "Group" t_matrix = t_matrix * entity.transformation # <== *NOT* t_matrix * entity.transformation.inverse entity.entities.each{|sub_entity| output_entity(sub_entity, t_matrix) } elsif entity.typename == "Face" mesh = entity.mesh 0 mesh = mesh.tranform! t_matrix # [Add output code here] end end Anyway, I'd still be curious if there's a more "internal" solution, but it seems like everything's working perfectly, and much less painfully than I'd expected. Kevin

Advertisement