🚨 Skimp | 25% Off until March 30 Buy Now

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
  • Can't regroup an exploded ComponentInstance

    10
    0 Szavazatok
    10 Hozzászólások
    2k Megtekintések
    Chris FullmerC
    This snippet works for me, and I think its fairly safe? (We'll let one of the other Ruby folk weigh in on that if they feel they need to ). random_classes = [] ents_to_regroup = [] a = Sketchup.active_model.selection[0].explode a.each do |e| random_classes << e.class end random_classes.uniq! random_classes.each do |e| single_class_objects = a.grep(e) if single_class_objects[0].respond_to?(;bounds) then ents_to_regroup << single_class_objects end end ents_to_regroup.flatten! Sketchup.active_model.entities.add_group(ents_to_regroup) This will take the selected component and explode it. It then looks at the class of every object that was returned and decides if that class can be added to a group by testing to see if an object from that class responds to the bounds method, (which is in the Drawingelement class and inherited by all valid SU geometry entities). So if an object from the given class does respond to the bounds method, then it is safe to try to add those objects back into a group. If they do not respond to that method, then they get skipped. Hopefully the logic makes sense. That snippet worked fine for me. You do have to have an object selected to test that piece of code. Chris
  • [Talk] Edit Mode Warning Flag (Beta)

    10
    0 Szavazatok
    10 Hozzászólások
    1k Megtekintések
    Rich O BrienR
    Edit
  • Hide selected objects from scenes except the active one?

    3
    0 Szavazatok
    3 Hozzászólások
    289 Megtekintések
    renderizaR
    Thanks TIG but there is a problem... Lets say I have two scenes with two objects and I select the 1st object from 1st scene and do the script...it will work but...if I go to 2nd scene and select the 2nd object to do the script when I go to 1st scene the 1st object ends up hidden as well which it was not supposed to. (Hope this makes sense) Anyhow it may be that the page.update needs to first select each page before doing update. So that means I can't use your suggestion but I did find a solution... Here is the code... model = Sketchup.active_model pages = model.pages sel = model.selection c_page = pages.selected_page skip = [] skip << c_page.name pages.each {|page| pages.selected_page = page if page.name != skip.first sel.each do |e| e.hidden = true end page.update end } page_num = 0 pages.each {|page| if page.name == skip.first pages.selected_page = model.pages[page_num] break end page_num+=1 } skip.clear Note: Updated the explanation a bit to fix it a little so it makes more scene hopefully.
  • Resolution of pre-distorted textures

    3
    0 Szavazatok
    3 Hozzászólások
    293 Megtekintések
    OricAtmosO
    Thanks for the suggestions! You're right, there's no single "tiling factor" in a distorted texture. I think I'll ignore this problem for now and solve more important issues first. By the way, is there perhaps some kind of exporter plugin template that does all the complicated stuff of getting the needed model information out of SketchUp? Something that's only missing the actual writing of the target file format.
  • Dynamic text

    4
    0 Szavazatok
    4 Hozzászólások
    280 Megtekintések
    TIGT
    I the massive PluginStore collection... Linked through the Resources menu above... There will be lots of useful 'cribs'...
  • Why I have to say goodbye

    5
    0 Szavazatok
    5 Hozzászólások
    596 Megtekintések
    H
    I personally felt the license agreement, and more so the language on the web site and download links, was always quite clear regarding commercial use. But more-so, I do agree with you, that it is a rather unfortunate change of course. My biggest fear, is that it will destroy the bulk of the creative efforts going into the 3D Warehouse. I personally get a great thrill out of downloading various space ships and crazy vehicle creations -- almost certainly the efforts of a 14 year-old boy somewhere out there on the internets. And there's no way they will be plopping down $500 to continue such endeavors. So if I may, I'd like to offer my suggestion -- perhaps a $199 price point for Make? Or go even further, and offer something integrated with the 3D Warehouse -- so as long as you upload at least 1 model a month to the Warehouse, you can continue using Make for free. More on the subject of your post, I feel it was a little naive of you to pursue a commercial business model off of the free software that Google was offering. I would recommend you stay with Sketchup, and contact their bulk sales department, to see if you could get some funding, and negotiate a good price to continue what sounds like an otherwise great business model. --J
  • Camera Jumps in orientation

    4
    0 Szavazatok
    4 Hozzászólások
    384 Megtekintések
    Chris FullmerC
    It actually re-orients the model's axis. So green is up and blue is shooting straight forward, like you asked for. You can write your own camera positioning tool and you can program it's "up" direction to be pointing any which way you want. But as soon as the user flips back to the built-in orbit tool, SU will default back to forcing the original model axis z, to be up. SU very strongly favors having the z axis not tilt left or right.
  • Reload component script - anyone have one

    21
    0 Szavazatok
    21 Hozzászólások
    4k Megtekintések
    B
    Thanks Dan, I hadn't noticed that behaviour before. Initially being only interested in getting a couple of components into the model it wasn't an issue and I would always have the proxies in the model to check that the swap worked ok. Looking at this again it looks like the components are all loaded into the file in turn. When I repeat ThomThom's text as below only Comp4 gets deleted if not required to replace comp3 (being the last to be loaded). Comp2 get left behind. newDef = model.definitions.load("J:/Comp2.skp") oldDef = model.definitions['Comp1'] oldDef.instances.each{|old_inst|old_inst.definition=newDef t = old_inst.transformation ents = old_inst.parent.entities ents.add_instance(newDef, t) old_inst.erase! } newDef = model.definitions.load("J:/Comp4.skp") oldDef = model.definitions['Comp3'] oldDef.instances.each{|old_inst|old_inst.definition=newDef t = old_inst.transformation ents = old_inst.parent.entities ents.add_instance(newDef, t) old_inst.erase! }
  • How to Use Graphing Gem in SketchUp Plugin

    11
    0 Szavazatok
    11 Hozzászólások
    1k Megtekintések
    tt_suT
    Ah, the docs are wrong. Why am I not surprised...
  • OSX - WebDialog blank initially?

    18
    0 Szavazatok
    18 Hozzászólások
    1k Megtekintések
    tt_suT
    New chapter for the Lost Manual.
  • Face-tag number

    12
    0 Szavazatok
    12 Hozzászólások
    907 Megtekintések
    pingpinkP
    Thank you very much,Renderiza ! I've tested the codes , it works very good.I can see the different panel types by coloured faces. I noticed the same face area of the sloped faces and the upright faces , they have different colours.I don't know why it happens for this time , I will look later. I just tried to map components on coloured faces , but I have to select faces and a panel component together to place and copy on the faces. Not sure that I have to do the attribute's name on coloured faces to have the same names as component's names for component mapping.
  • Strange behavior in derived class

    11
    0 Szavazatok
    11 Hozzászólások
    811 Megtekintések
    tt_suT
    If you extend and instance with module "FooBar" then you can use instance.is_a?(FooBar)
  • Pick closest point of a polyline

    3
    0 Szavazatok
    3 Hozzászólások
    787 Megtekintések
    T
    @tig said: Let's start simple... Thanks, TIG, for the suggestion. Unfortunately it does not work very well at all, basically because in 3D the mouse represents a ray, not a point. Sketchup generates a point via InputPoint and PickHelper using a heuristic that does not work very well at all in this application. I have a method that works well: get the mouse ray via view.pickray(x,y) loop over all segments of the polyline compute the position along the line containing the segment, where the ray is closest to the line trim that to the endpoints of the segment compute distance from the resulting point to the ray remember the closest one now I have the segment and location within the segment of the mouse generate the Geom::Transform for that location Basically this represents the centerline of a particle accelerator, and the code is inside my custom DragTool, using the mouse to place an object along the centerline; so the object is constrained to lie on the centerline, and its local z-axis is aligned with the centerline where it is located. For <= 200 segments this tracks the mouse quite well; for 1000 segments it takes about 1 second to catch up. That's acceptable for now; ultimately I may optimize it. I'm rather surprised that this much Ruby computation is acceptable. If a segment is parallel to the pickray, the math will divide by zero. So my code disallows any segment that is nearly parallel to the pickray. This makes sense, as the user cannot possibly select a position along such a segment; use the middle button to rotate the display so the desired position is visible. I ended the centerline with a half-infinite straight line. SketchUp cannot draw that (or rather, it tries to do so, zooming out so much that it's useless). So I split the final segment in two, with the first being half as long as the preceding centerline; the code does not display the final segment. The next challenge is to generalize this to include segments that are circular arcs (so far the code is limited to radius=0).... If anyone wants my code, or references to the geometrical calculations I'm using, just ask.
  • Link failed for Sketchup on Mac OS X

    5
    0 Szavazatok
    5 Hozzászólások
    384 Megtekintések
    Z
    Thanks, really appreciate your help. Now I am clear and wait for the 64-bit SDK.
  • Module variables and nested class

    11
    0 Szavazatok
    11 Hozzászólások
    666 Megtekintések
    A
    Thank you ThomThom Moving to instance variables
  • Detecting a flipped transform.

    13
    0 Szavazatok
    13 Hozzászólások
    3k Megtekintések
    tt_suT
    This is digging up an old thread, but here's a snippet I think should work: <span class="syntaxdefault"><br />module&nbsp;TransformationHelper<br /><br />&nbsp;&nbsp;def&nbsp;flipped_x</span><span class="syntaxkeyword">?<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">axes_dot_products</span><span class="syntaxkeyword">()<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_x&nbsp;</span><span class="syntaxkeyword"><&nbsp;</span><span class="syntaxdefault">0&nbsp;</span><span class="syntaxkeyword">&&&nbsp;</span><span class="syntaxdefault">flipped</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">end<br /><br />&nbsp;&nbsp;def&nbsp;flipped_y</span><span class="syntaxkeyword">?<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">axes_dot_products</span><span class="syntaxkeyword">()<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_y&nbsp;</span><span class="syntaxkeyword"><&nbsp;</span><span class="syntaxdefault">0&nbsp;</span><span class="syntaxkeyword">&&&nbsp;</span><span class="syntaxdefault">flipped</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">end<br /><br />&nbsp;&nbsp;def&nbsp;flipped_z</span><span class="syntaxkeyword">?<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">axes_dot_products</span><span class="syntaxkeyword">()<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_z&nbsp;</span><span class="syntaxkeyword"><&nbsp;</span><span class="syntaxdefault">0&nbsp;</span><span class="syntaxkeyword">&&&nbsp;</span><span class="syntaxdefault">flipped</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">end<br /><br />&nbsp;&nbsp;</span><span class="syntaxkeyword">private<br /><br />&nbsp;&nbsp;</span><span class="syntaxdefault">def&nbsp;axes_dot_products<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxkeyword">[<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">xaxis</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dot</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">X_AXIS</span><span class="syntaxkeyword">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">yaxis</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dot</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Y_AXIS</span><span class="syntaxkeyword">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">zaxis</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dot</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Z_AXIS</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;&nbsp;&nbsp;]<br />&nbsp;&nbsp;</span><span class="syntaxdefault">end<br /><br />&nbsp;&nbsp;def&nbsp;flipped</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">dot_x</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_y</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxdefault">dot_z</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">dot_x&nbsp;</span><span class="syntaxkeyword">*&nbsp;</span><span class="syntaxdefault">dot_y&nbsp;</span><span class="syntaxkeyword">*&nbsp;</span><span class="syntaxdefault">dot_z&nbsp;</span><span class="syntaxkeyword"><&nbsp;</span><span class="syntaxdefault">0<br />&nbsp;&nbsp;end<br /><br />end<br /><br /><br />module&nbsp;Example<br /><br />&nbsp;&nbsp;def&nbsp;self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">inspect_flipped<br />&nbsp;&nbsp;&nbsp;&nbsp;tr&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">transformation<br />&nbsp;&nbsp;&nbsp;&nbsp;tr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">extend</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">TransformationHelper</span><span class="syntaxkeyword">)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">p&nbsp;tr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">flipped_x</span><span class="syntaxkeyword">?<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">p&nbsp;tr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">flipped_y</span><span class="syntaxkeyword">?<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">p&nbsp;tr</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">flipped_z</span><span class="syntaxkeyword">?<br />&nbsp;&nbsp;</span><span class="syntaxdefault">end<br /><br />end<br /></span>
  • Newbie

    5
    0 Szavazatok
    5 Hozzászólások
    289 Megtekintések
    tt_suT
    Here's some getting started tips to SketchUp Extension development: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/ Check out the rest of the blog for more articles.
  • Area to text

    4
    0 Szavazatok
    4 Hozzászólások
    242 Megtekintések
    tt_suT
    Note that when computing the area of the faces you want to apply the transformation of the parent context in order to get the correct size. The Face.area method accepts and optional transformation argument.
  • Distributing models with sketchup and plugins installed

    8
    0 Szavazatok
    8 Hozzászólások
    697 Megtekintések
    zobo3360Z
    I agree! I am using the LinksManager Plugin by Dieder...His instructions on using the plugin require that you unzip the file into the Plugins folder. It will not work to copy and paste the folder into the Plugins folder. ThomThom recommended that I try to open the plugin from a sketchup shortcut using an argument. It creates the icon. But because the encrypted part of the plugin does all the functional work, I can not modify it to look to another drive for the files. (The error I get when I run the .rb part of the plugin in the ruby console is that the .rbs is undefined). I am thinking it will be best to try and create one .zip package that contains everything I need to distribute, and puts it into the Plugins folder so that I don't have to remap the location of the .rbs file. My group of users is small~10, they have no experience with sketchup, and they may or may not have access to the internet...I know--the dark ages. I need to make the process of accessing the collaborative model as easy, painless, and complete as possible. The group requested that I distribute hard copies of all needed peices--software, plugins, model, files, on a DVD drive. The next best option is an external hard drive. I have to get this to work, so invent I will! (Unless someone comes up with a slick way to solve this ) Thanks for your help!
  • Change plugin variables within Undo

    4
    0 Szavazatok
    4 Hozzászólások
    415 Megtekintések
    danielbowringD
    you could store the value/flag on the model instead, then it would also change with the undo steps model = Sketchup.active_model model.set_attribute('maricanis', 'dl_materials_changed', true) #... model.get_attribute('maricanis', 'dl_materials_changed', false)

Advertisement