@tntdavid said:
The plugin is in the right place!
I think the problem has to be tied to something else.
Can you share your "rbz" file?
Your soluition is great and very interesting.
Thank you
David
Hope this helps.
@tntdavid said:
The plugin is in the right place!
I think the problem has to be tied to something else.
Can you share your "rbz" file?
Your soluition is great and very interesting.
Thank you
David
Hope this helps.
That would be correct if the plugin is in "C:\Users\Dada\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins"
There is no need to import the materials. The code simply re-defines the texture to be used. If the newly created materials are still 'black', then the textures are not where they should be.
This seems to work for the 3 'sets' of materials I created.
def cycle_materials
mat_names = ['60x40','80x40','100x40']
materials = Sketchup.active_model.materials
mat_names.each{|mn| materials.add(mn) unless materials[mn]}
mat_folder = File.join(File.dirname(__FILE__).gsub('\\','/'),"TNT_ClickCuisine2/Materials/")
@last ||= '0'
@last=='3' ? @last='1' ; @last=@last.next
for mn in mat_names
material = materials[mn]
material.texture = mat_folder + "#{@last}-#{mn}.jpg"
end
end
@sweek said:
Do you know if people get group's dimension like I did or if they use another way ?
Be aware that bounds dimensions of the container 'B' can and do change when rotated. The sub_groups, 3 and 4, are unaffected. Creating a new bounding box isn't necessary. It will be the same as the entities bounds. Use .local_bounds for the container, which gives you the initial dimensions, then use the x,y and z scales from the transformation to give you the current size.
model = Sketchup.active_model
selection = model.selection
selection.each do |entity|
bb1=entity.local_bounds; tr1=entity.transformation
UI.messagebox("Name; #{entity.name}\nWidth; #{bb1.width*tr1.xscale}\nHeight; #{bb1.height*tr1.yscale}\nDepth; #{bb1.depth*tr1.zscale}")
entity.entities.each do |sub_entity|
bb2=sub_entity.bounds
UI.messagebox("Name; #{sub_entity.name}\nWidth; #{bb2.width}\nHeight; #{bb2.height}\nDepth; #{bb2.depth}")
end
end
My "Clip or Trim Terrain Mesh" should do that for you.
Just how did you create 3 and 4 inside of B?
If I create 3 and 4, stack them, then group them to create B, your code works as expected.
@ittayd said:
In Sketchup most of the tools contain a sort of "wizard" where the status line tells you what to pick and then when you pick it, what to pick next, etc. How can I do this in an extension?
The set_status_text method is used to set the text appearing on the status bar within the drawing window.
If no arguments are passed, the status bar content is cleared. Valid positions are:
SB_PROMPT - the text will appear at the left-side of the status bar
SB_VCB_LABEL - the text will appear in place of the VCB label
SB_VCB_VALUE - the text will appear in the VCB
Sketchup.set_status_text "This is a Test", SB_VCB_VALUE
@tuna1957 said:
major duh moment for me. gotten so use to using vertex tools forgot the simple way.
sdmitch curious why the alt key comes into play ? just checked on my mac, left to right selection and move tool gets me there..... is it a windows thing ?
The up or down arrow would achieve the same but the Alt key is what I thought of first.
@alvis said:
Hi to all. I have a lot of different components with the same material. Is there some quick way to select all components with the same material.
Thanks
Select by Material on my blog may do it for you. Make the material you want to select the current material by selecting it in the materials browser then execute the plugin.
@medeek said:
@Sdmitch: I'm testing your Subtract tool you sent me a while back and it almost works! However when the subtraction breaks the solid group into more than one physical solid then the process seems to break down slightly.
Yes, I see where it would since it the opposite of what you are trying to accomplish with the slab and rebars. I will PM you the interactive tool version of the plugin I demonstrated in my previous post.
@pilou said:
seems working perfectly in 2017!
[attachment=0:ocy8vhzy]<!-- ia0 -->sdm_floor.jpg<!-- ia0 -->[/attachment:ocy8vhzy]
I think he has version 7 not 2017.
@medeek said:
I replace the set color line with:
view.set_color_from_line(@pts[@lastpointcount], @pts[@pointcount])
however the behavior is identical.
I too find it odd that entering a length suddenly causes the axis inference to change its' behavior. The tooltip seems to think that @ip1 is still valid while, if you zoom in and move the mouse very slowly, the correct inference will occur. After that everything is back to normal until the next length entry.
Very strange indeed and an obvious bug in Sketchup.
@markpyvi said:
Can I please have a link for SU7. Latest one doesn't seem to work in SU7.
Cheers,
Mark
Sorry I can't. There is only one version.
@medeek said:
I've got the polygon positioning tool mostly worked out for my foundation plugin. However, when the user enters in a value for the length of the segment (VCB_VALUE) then the subsequent line selection does not properly infer the X and Y axis.
There are two problems as I see it.
You are using @ip1 and @ip to set the line color but, when you enter a length, @ip1 is no longer valid since the point it represents has changed. I think you should use the last to values of the @pts array to set the color.
Expecting the user to get within 0.0001 of the first point to close is way to restrictive.
@rogalxxx said:
why is there no option for an origin point where you click? Why center or left lower corner only? I mean this would be useful
Because I assumed that the center or a corner were the most logical points of origin. FYI, the closest corner to the point you pick is used. Not just the lower left corner.
Try this
@mod = Sketchup.active_model
@sel = @mod.selection
cmps = @sel.grep(Sketchup;;ComponentInstance)
cmps.each{|ci|
ctr = Geom;;Point3d.linear_combination(0.5,ci.bounds.corner(0),0.5,ci.bounds.corner(3))
xscl = (ci.bounds.width+0.1.m)/ci.bounds.width
yscl = (ci.bounds.height+0.1.m)/ci.bounds.height
tr = Geom;;Transformation.scaling(ctr,xscl,yscl,1.0)
ci.transform! tr
}
@skastafari said:
I don't want to be a recursive idiot (though I am) and need some help solving a problem.
Problem is I have all these nested components and they are named foo.
I need to remove all component instances named foo from their parents and place them in their own new component named foobar. I had some embarrassing failures at this and it is clearly over my head. I can use some pro suggestions/solutions and I am thinking a ruby script is the way to go as I can hardly maintain my sanity doing this much work manually.
Maybe this will help.
@mod = Sketchup.active_model
@ent = @mod.active_entities
@sel = @mod.selection
cntrs = @sel.grep(Sketchup;;ComponentInstance)
for cntr in cntrs
cde=cntr.definition.entities
foos = cde.grep(Sketchup;;ComponentInstance).select{|ci|ci.definition.name=='foo'}
foos.each{|f|tr=cntr.transformation*f.transformation;
fb = @ent.add_instance(f.definition,tr);
fb.definition.name='_foobar_' if Sketchup.version.to_i>=14
fb.definition.name='foobar'
f.erase!
}
end