🏒 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Newbie's anxiety ---- simple question

    3
    0 Votes
    3 Posts
    234 Views
    B
    really helpful!!! thanks a lot
  • Face front side outwards

    3
    0 Votes
    3 Posts
    497 Views
    mitcorbM
    Hi, morci429: Perhaps this recent development from honoluludesktop? http://forums.sketchucation.com/viewtopic.php?t=32088#p283327
  • UI.openpanel - wildcard bug

    7
    0 Votes
    7 Posts
    706 Views
    Dan RathbunD
    @honoluludesktop said: Someone previously showed me that it works this way. chosen_file=UI.openpanel("Select DXF File","", "*.Dxf") And also like: chosen_file=UI.openpanel("Select DXF File","*.Dxf") However... Windows will use it's own directory paths it automatically saves into the Registry, for each file extension. (1) If the openpanel has never before selected a *.dxf file, then the openpanel will (likely) open in the user's My Documents folder. (2) If the User did previously select a *.dxf file, with the openpanel, Windows will open in the Most Recently Used (MRU) path Windows saved for the *.dxf extention. Setting the working directory via Dir.chdir has no effect on what directory the openpanel starts in.
  • Get group location over Ruby Script

    10
    0 Votes
    10 Posts
    3k Views
    H
    @tig said: tr=group.transformation to that point pt.transform!(tr) Thank you very much for the tip !
  • Ruby <-> cmd command line: How to get return value?

    4
    0 Votes
    4 Posts
    4k Views
    TIGT
    This might be clearer ruby: x="E;/new_batch.cmd" UI.openURL(x) returns true batch file: @echo off echo "Hello World" echo pause exit Waits for you to close it... x="file:/E:/new_batch.cmd" will also work... Writing the bat or cmd file to the root directory would probably be better if it were into a Temp folder ?
  • How to add coordinate into SU api

    20
    0 Votes
    20 Posts
    2k Views
    Dan RathbunD
    @borg.stef said: ... and it gives me this error: #<NoMethodError: undefined methodpoint3d' for Geom:Module>` Because methods begin with lower case identifiers. Class (and Module,) indentifiers are titlecase. @borg.stef said: How can i put a simple model in the required location? I did the following coding: model = Sketchup.active_model pt = Geom::point3d.new(0,0,0) tr = Geom::Transformation.new(pt) model.transform!(tr) The model origin is already at [0,0,0], and there is a constant ORIGIN for it. So your code above does nothing.
  • Slicer-excellent ruby

    19
    0 Votes
    19 Posts
    11k Views
    TIGT
    I have reported the weirdness to the powers that be at Google - it is certainly reproducible although I had never seen it before... Meanwhile the temp fix 'Triangulate Faces' is here http://forums.sketchucation.com/viewtopic.php?p=175613#p175613 for the rest of you...
  • Calculating bezier curve smoothness?

    7
    0 Votes
    7 Posts
    554 Views
    mitcorbM
    Check his updates at the end of the article also.
  • Api-diagram

    5
    0 Votes
    5 Posts
    399 Views
    Dan RathbunD
    @larsen said: Please, is this api diagram correct? NO (you should remove it.) Thanks for taking it down Larsen There are links to the available diagrams: SketchUp Ruby API - Class Diagram http://code.google.com/apis/sketchup/docs/diagram.html Sketchup Ruby API Class Diagrams by Jim Foltz http://sketchuptips.blogspot.com/2008/08/sketchup-ruby-api-class-diagrams.html
  • Calculating the final vertices of a nested face

    3
    0 Votes
    3 Posts
    283 Views
    S
    @tig said: Have you tried tr=container.transformation.inverse and applying it to the initial object and then iterating and getting/setting the transformation for the container's container etc until you get to the model level... That didn't seem to work (inverse), though I may very well have misunderstood what you meant, but what you said gave me an answer anyway. By applying the transform to the points at each container successively, it works perfectly! (or at least in every test so far) Which is how I should have tried it initially but I was thinking from a performance standpoint, and forgot the old adage "premature optimization is the root of all evil" def WALK.GetParent(ent) Sketchup.active_model.start_operation("Walk") model = Sketchup.active_model @newg = model.entities.add_group m = model.materials.add "test" m.color="red" orig = ent tpos = Geom;;Point3d.new 0,0,0 # keep track of origin trans = Geom;;Transformation.new(Geom;;Point3d.new(0,0,0)) # add transforms to this vertices = orig.outer_loop.vertices.map {|v| v.position.clone} while (ent.respond_to?('parent') ) # walk up hierarchy if ((ent.is_a? Sketchup;;ComponentDefinition)) if ent.group? t = ent.instances[0].transformation # Get the group's transform vertices.each_with_index do |v,i| vertices[i].transform! t end end ent = ent.instances[0] # become the instance end ent = ent.parent end f = @newg.entities.add_face vertices # create the face f.material=m Sketchup.active_model.commit_operation end Thanks again for the help!
  • Validate points for planar faces.

    4
    0 Votes
    4 Posts
    366 Views
    D
    Anyone has any suggestions?
  • How to receive the size of a line Sketchup rubi

    6
    0 Votes
    6 Posts
    2k Views
    TIGT
    You CAN sort of fudge it... make a separate SKP file containing a dimension 1" long and 1" offset. Then in code load it as a component into your SKP. Add an instance at a point and scale it in the X to match the length to another point and in the Y for the offset needed. You also need to transform-rotate it so that it aligns with the vector of the two points etc... When done you can explode the dim-component instance back into a plain dimension. An dims added this way will ever be linked to an edge or vertex as in a manually added one... You could perhaps include a 1" long edge in the dim-component that the dim refers to... and if that then replaced the original line below it when exploded it might keep some linking ? It's better than nothing... but only just...
  • Author/credits API ?

    13
    0 Votes
    13 Posts
    871 Views
    TIGT
    There is no 'name=' option for dictionaries - you have to clone the whole thing with a new name and delete the original. The core-code magically prevents the specific dictionary name [GSU_ContributorsInfo] from being 'made' or edited by the standard users [although we have seen that 'deleting' it is possible - but I'd think that's probably an oversight by Google] - BUT of course it IS editable somehow... because Google can do it !
  • Attribute dictionary in callback

    8
    0 Votes
    8 Posts
    328 Views
    TIGT
    @kdasilva said: I appreciate all your help, but I am still unsure on why my get get_attribute method would return nil in a different call back? is there a scope issue I am not accounting for? the get_attribute works within the same callback so I am lead to believe that the instance name is working as a key... Did you check that the 'key' was acceptable ? You were setting the attribute for the model etc ? Rather that try an do it directly in the call_back make a method and run it with self.callback1() etc... What you are trying to do is relatively straightforward ... just break it into logical steps......
  • Make SU heal faces and edges?

    8
    0 Votes
    8 Posts
    3k Views
    thomthomT
    @gulcanocali said: @thomthom said: Don't think you can create zero length edges via Ruby. model.active_entities.add_line( ORIGIN, ORIGIN ) <- returns nil The first step in my note should have been "move the vertex on top of the other vertex you want to merge with" (then there may be an edge with zero length). After that follow the next two steps. That seem to have worked. Though temp groups and edges feels a big hacky - I wonder if there's a cleaner way. Would be interesting to get some insight to how SU does this internally. But thank you very much for this working method!
  • .execute_script interesting quirk

    7
    0 Votes
    7 Posts
    262 Views
    thomthomT
    @dan rathbun said: I think there is a whole topic on this concerning "Javascript:void(0);" vs "Javascript:return;" one of which needs to be in the HREF tag, the Ruby callback needs to be in the onClick call. To avoid triggering an A HREF link, and instead execute some other JS code, you return false to the onclick event.
  • Edge color by material

    5
    0 Votes
    5 Posts
    488 Views
    TIGT
    I was still editing my post when you replied... There are lots of ways of modifying your rendering appearance...
  • Creating a 3D wall from 2Dpoints(line),Width and Height

    2
    0 Votes
    2 Posts
    282 Views
    TIGT
    I assume that you have successfully applied xyz values to these points needed to make these lines; and put then into an array called 'pts'. You could use... lines=entities.add_edges(pts) where 'lines' is an array of the lines made. now to make the wall - I think the easiest in this case is to make a rectangular vertical face, the width [8"/20cm] and height [12'/3.6m] and then use 'followme' on that face with the lines as the path. So make the face at the origin.... face_pts=[[0,0,0],[8,0,0],[8,0,144],[0,0,144]] face=entities.add_face(face_pts) Transform the face's vertices so it is perpendicular to the vector of the first line in 'lines' vector=pts[0].vector_to(pts[1]) angle=face.normal.angle_between(vector) transformation=Geom::Transformation.rotation(ORIGIN, Z_AXIS, angle) entities.transform_entities(transformation, face.vertices) face.reverse! Move the face to the start of the first line in 'lines' transformation=Geom::Transformation.translation(ORIGIN.vector_to(pts[0])) entities.transform_entities(transformation, face.vertices) Now do the followme face.followme(lines) Done...
  • MAC-SU utility tool needs some testers

    3
    0 Votes
    3 Posts
    734 Views
    D
    @tfdesign said: John, would you be so kind as to explain what a "Mac editing Bridge" actually is? I'm sure if you explained what you are trying to achieve in a clearer, more 'laymans terms' kind of way, there would be far more interest. Tom Hi Tom, If you have an interest in how to make or fix rubies to use on a PC there are a couple of 'Bridges' that you can use between SketchUp and a more familiar or powerful script editor that you fancy. Their called bridges because they allow two way communication with SU to varying degrees. That means your not guessing as much, because you can check more often in a given time frame. No such 'Bridge' exists for Mac-SU, so you do a lot of copy/pasting between the external editor and Ruby Console. A second issue then arises is that SU has some limits to how many 'lines' you can copy/paste in before it 'bogs-down' and you need to 'purge' Ruby Console. Of course there's no Mac equivilent of the PC purge ruby, so you need to quit, restart, close the buggy start page, open a new page, open Ruby Console and then start copy/pasting again until it's slow or 'bug-splat's'. In a single session, you might this 100's of times, and it's a pain. So, I started playing around with Applescript to ease some of my pain, and found I can get it to do quite a bit in SU through UI [user imput] manipulation. That means, if there's a Menu Item, a Window Button, a Shortcut Key, etc... you can click it with applescript. (I highlight can because the how can be tricky) SU also uses a self preservation ruby, so some thing's can't be done from inside (an example is that a plugin in SU can't tell SU to quit, unless it does it through a separate external process) So, while I've been improving on these scripts/apps for my own use, I just thought there may be others interested. The 'new with my toolbars' and the 'kill button' alone would make life easier if you open SU more than twice a day and use 'beta' plugins. The next step is to get applescript to switch out the plugins before starting SU, so you have a button for drawing tools, one for advanced editing, one for prepping renders, or whatever. Applescript is brilliant at moving files around for processing in the background, so there's a lot of potential once we have a library of what works. Personally I've spent a great deal of time looking for 'cross platform' solutions when there may actually be very good built in tools for many of the problems. Every Mac owner has the very powerful 'Script Editor' and 'Automator' as standard and can upgrade to 'Xcode' from their instal disc's if they wish, so I think it's worth a look... cheers for your interest, I'll post the update for the app on the other 'Mac' thread for now. john
  • Toolbar problem in SU 8 on Windows

    27
    0 Votes
    27 Posts
    2k Views
    Al HartA
    We are still struggling with Toolbars in SU8. Our biggest remaining problem, is that that when we load a plugin by hand, rather than having it loaded automatically as SketchUp loads - (we offer both options to users - always load the app, or manually load it from the Plugins menu) - the toolbar appears - but is not docked. I looked at your code snippet in the other thread, but it is hard to figure out how to put everything together. Can you, (or someone), provide a .RB which I can execute manually, (not placing it in the plugins folder - but loading the .RB from the ruby console - or later from the Plugins menu), which creates a new toolbar, and docks it properly? Then I can grab from it what I need, etc. to get it to work with our app.

Advertisement