ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • How to get edge/line color?

    6
    0 Votes
    6 Posts
    356 Views
    B
    Perfect, those rendering options will come in handy! This works great, thanks Jim
  • [Code] YARC – yet another ruby console

    22
    0 Votes
    22 Posts
    4k Views
    A
    @anton_s said: I recommend putting the whole __FILE__ That's very reasonable. I'll fix it. I just wanted to let you all know that I'm working on improvements (esp. the snippets should have been saved over sessions) but I'm a bit busy at the moment. I'll publish a next version when I'm ready.
  • Using Unit Test with SketchUp for Debugging & Testing

    3
    0 Votes
    3 Posts
    312 Views
    S
    Joe, Thanks for posting this. I was going to eventually, but got tangled up in other things and didn't get around to it/ I hope it is useful to others. Steve
  • RETRIEVE SCALE

    3
    0 Votes
    3 Posts
    400 Views
    A
    Thanks ! it's works and I use def scaleX() Math.sqrt(self.to_a[0]**2+self.to_a[1]**2+self.to_a[2]**2) end def scaleY() Math.sqrt(self.to_a[4]**2+self.to_a[5]**2+self.to_a[6]**2) end def scaleZ() Math.sqrt(self.to_a[8]**2+self.to_a[9]**2+self.to_a[10]**2) end
  • Position_material problem

    7
    0 Votes
    7 Posts
    240 Views
    M
    Hi Thom, Here is example and results (I'm obviously doing something wrong, but not sure where the problem is). In model I have 2 groups: group1 - consisting of 2 subgroups, where one subgroup contains face we analyze in example group2 - consisting of some object. Here is the code, to get the face I go through hierarchy - but every time it is the same face face = Sketchup.active_model.entities[1].entities[1].entities[14] p1 = face.outer_loop.vertices[0].position t1 =Sketchup.active_model.edit_transform p1_trans_inv = p1.transform(t1.inverse()) puts "P1 coordinates [#{p1.to_a.join(',')}]" puts "Edit_transform [#{t1.to_a.join(',')}]" puts "Edit_transform_inverse [#{t1.inverse.to_a.join(',')}]" puts "P1_transform_inverse [#{p1_trans_inv.to_a.join(',')}]" Absolute P1 coordinates in SU coordinate system are:[-393.700787401575,196.850393700787,0.0] I call this small script for various cases of opened groups inside model and here are results: *opened group where face is P1 coordinates [-393.700787401575,196.850393700787,0.0] Edit_transform [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,-548.031496062992,196.850393700787,0.0,1.0] Edit_transform_inverse [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,548.031496062992,-196.850393700787,-0.0,1.0] P1_transform_inverse [154.330708661417,0.0,0.0] *closed group with face, opened parent group P1 coordinates [154.330708661417,0.0,0.0] Edit_transform [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,-548.031496062992,196.850393700787,0.0,1.0] Edit_transform_inverse [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,548.031496062992,-196.850393700787,-0.0,1.0] P1_transform_inverse [702.362204724409,-196.850393700787,0.0] *closed group with face, opened parent group, opened other group in the parent P1 coordinates [154.330708661417,0.0,0.0] Edit_transform [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,-367.646959030915,310.128373863173,80.3149606299213,1.0] Edit_transform_inverse [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,367.646959030915,-310.128373863173,-80.3149606299213,1.0] P1_transform_inverse [521.977667692332,-310.128373863173,-80.3149606299213] *closed group, closed parent group, opened some other group P1 coordinates [154.330708661417,0.0,0.0] Edit_transform [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,-464.698354923942,49.8468801242114,-1.13686837721616e-013,1.0] Edit_transform_inverse [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,464.698354923942,-49.8468801242114,1.13686837721616e-013,1.0] P1_transform_inverse [619.029063585359,-49.8468801242114,1.13686837721616e-013] *closed all groups P1 coordinates [154.330708661417,0.0,0.0] Edit_transform [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0] Edit_transform_inverse [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0] P1_transform_inverse [154.330708661417,0.0,0.0] As you can see using inverse edit_transform gives each time different results for 'P1_transform_inverse', depending which group is opened - and my goal is to get in each case the same results (since these should be absolute coordinates) Also notice- that when group with face is opened- we get absolute coordinates (and not relative to the group origin), while in all other cases we get relative coordinates for p1. So as in previous mail my question is how to get correct absolute coordinates for all other cases (when group with face is closed, and some or no other groups are opened)? Thanks for patience, Marija
  • SketchUp API Documentation for redraw and redraw_with_undo

    2
    0 Votes
    2 Posts
    389 Views
    Dan RathbunD
    No there is no documentation. Technically... DynamicComponents is a Google/Trimble extension. And it is not OpenSource. Practically... it works (and is thought of,) as part of the Sketchup application itself. (The fact that it's written in Ruby, raises some stability issues if a lot of people began messing with it. And.. also, it would run alot faster if it was re-written in C/C++.) What you may not have realized.. is that DC are really just Sketchup::ComponentInstance instances, that have specially named attribute dictionaries and attributes, that are used by the extension, to do nifty things. Because it is an authored extension, it's internal workings are subject to change. Even it's internal methods could change their names, but externally, end-users, and scripters, might interact with them in the same way (or without much change.) So, much of what we know, has come from little tidbits, revealed by the members of the SU Dev team, .. and we can assume, that they have told "the world", what they are comfortable revealing. Or.. it may be that Google was never willing to spend the money, to produce the documentation. Or perhaps.. maybe the Ruby version V1 is the proof of concept... and they always had hopes of "baking it into" the C-side API code. (But just have never had that phase percolate to the top of the "to do" list.) Anyway.. if that happens, who knows what the method names exposed to Ruby might be ?? This latter possibility, is the reason I never attempted (even though I thought about it,) to write a reference manual for DCs myself. (That and I would imagine, they would have to give their "blessing" for it. I'd never do something like that without asking. Wouldn't like it if someone did it to my closed source work, without permission.)
  • Ruby to connect lines and make face?

    4
    0 Votes
    4 Posts
    3k Views
    L
    Using the "K" button will help you view hidden lines quickly. This can help GREATLY with connecting faces. Also it helps you snap components that get confused with the zoom.
  • [Info] Notepad++ : Tip, Tricks & Plugins

    14
    0 Votes
    14 Posts
    7k Views
    Dan RathbunD
    It's quite easy to customize your Right-Click Popup ContextMenu in Notepad++ For this example, we use the SessionManager Plugin by Mike Foster. (The plugin is now up to version 0.6 and works very well now. So update if you have an older version.) I have many project sessions saved, and now start Notepad++ with an empty session, and choose which project I will work on. There are two issues. (1) The "Plugins" menu is huge! And having to go through it to get to the "Session Manager" sub-menu, each time, is a bummer. (2) Even though the "Shortcut Mapper" is powerful, there is no way (that I can find,) to list those that have already been assigned. And a multitude have been! I do not know whether I will interfere with a shortcut that is already in use. So instead, I added a ContextMenu sub-menu: On the main menu: Settings > Edit Popup ContextMenu (Click the OK button to have NPP open your user contextMenu.xml file.) After the file opens, scroll down to the section beginning: <!-- To add plugin commands, ..... --> ... Add just below that comment (and above the lines adding "base64 encode" commands,) the following lines (if your running English and the actual "Session Manager" menu items are in English.): <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Sessions..." /> <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Settings..." /> <Item FolderName="Session &Manager" id="0"/> <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Save current" /> Now.. restart NPP, and you will now have a "Session Manager" submenu on the right-click popup context menu. So launch a session: Right-Click, M, ENTER BUT.. say you do not like the author's menu item names (there are 3 that begin with "S" and Windows' built-in 'starting letter' menu accelerators will not work for items, that are on a menu where other items also begin with the same letter.) No problem ... the contextMenu.xml format allows you to use a different name (and accelerator letter,) than the plugin author used in his "Plugins" sub-menu. Add an ItemNameAs= attribute, to the Item tag. Say that you want the accelerator to be "S" for the "Session Manager" popup sub-menu, and rename the menu items, and specify what accelerator will fire them using &: (I also went up near the top of the file, and changed the accelerator for "Select All" to "A".) <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Sessions..." ItemNameAs="&Control..."/> <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Settings..." ItemNameAs="&Options..."/> <Item FolderName="&Session Manager" id="0"/> <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Save current" ItemNameAs="&Save Current Session"/> <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Help" ItemNameAs="&Help"/> <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="About..." ItemNameAs="&About..."/> [whoops... fixed the typos, so all the & in the same place.] So I open Notepad++, Right-Click, and press "S" then "C", and choose which of my sessions I will work on. And, on my machine, the context menu now looks like this: [image: VaoK_npp_popup_session_mgr_submenu.png] A last word: The attribute PluginEntryName must be the plugin sub-menu title, as it appears in your localized langauge. The same for the PluginCommandItemName, it must be the sub-menu item you wish to clone, exactly as it appears on the main Plugins > whateverPlugin sub-menu.
  • [Code] Detect Window's VirtualStore

    9
    0 Votes
    9 Posts
    2k Views
    thomthomT
    @dan rathbun said: So did "Run as Administrator" allow you to write files where you wanted, rather than the VirtualStore ?? Didn't try that - because my fileread was triggered by the drag and drop which was prevented. But it'd be worth testing. @dan rathbun said: And.. are you saying that file writing is even more of a P.I.T.B on Win8, than it was in previous versions ?? I don't know - I've always used an administrator account on Vista and Win7 with UAC disabled. I cannot compare because Win8 is the first Windows OS I've tried with default user access. I suspect it's the same as Win7 and Vista, but I need to verify this.
  • C Extension on OSX crashes SU

    18
    0 Votes
    18 Posts
    3k Views
    thomthomT
    @nikus_knx said: @thomthom said: I guess it'd be worth compiling this info into a how-to article... Did you do this? I can't found it... I got a Hello World project tutorial over at BitBucket: https://bitbucket.org/thomthom/sketchup-ruby-c-extension SCF thread related to the tutorial: http://forums.sketchucation.com/viewtopic.php?f=180&t=41077
  • Floorplan app on ipad

    2
    0 Votes
    2 Posts
    277 Views
    S
    I guess my question was whether people thought an application hosted on a desktop and controlled using remote access software from the IPad would be effective. Local IPad developers think it would be too slow. \
  • Output 3d model by small tiles

    4
    0 Votes
    4 Posts
    143 Views
    J
    I still couldn't solve the problem. Could some guru here please help? Thanks a lot.
  • Fastest way to retrieve the corners that make up a face?

    9
    0 Votes
    9 Posts
    231 Views
    thomthomT
    @dan rathbun said: ADD: For some reason, for .. in loops are faster than each block methods. They may be faster - because they don't create a local variable scope - the scope is shared with it's parent scope. Creating variables in Ruby is an expensive operation, so if you create variables within an each loop it's created every time, within a for loop it's reused.
  • Export animation with Ruby

    12
    0 Votes
    12 Posts
    1k Views
    R
    Amazing!! I will dive right into it! Thank you so much for your patience, Dan. I will update my results here (if I make it that far
  • SketchupExtension in a single file

    13
    0 Votes
    13 Posts
    2k Views
    thomthomT
    @dan rathbun said: NO (the above,) will not work because Sketchup::require() and Sketchup::load() do not raise LoadError. They just return false on failure, and 0 on success. (I do have a API bug report filed on this.) They don't raise LoadError ...? That's interesting. My mistake was that I tested the whole thing by loading manually from an external location instead of placing the file in the Plugins folder and having it load at startup. My "simulation" was incorrect.
  • Edit materials from code

    11
    0 Votes
    11 Posts
    151 Views
    D
    this is what I have achieved so far entidad = %(#FF8000)[Sketchup]%(#0040BF)[.active_model.selection][0] curretmaterial = entidad%(#0040BF)[.material] nameM = curretmaterial%(#0040BF)[.name] curretmaterial%(#0040BF)[.color]=[102, 0, 51] curretmaterial%(#0040BF)[.name]=%(#BF8080)["nuevo tono"] I shall be able then apply the recommendations (sorry for bad English)
  • Determine if face is pointing toward center

    3
    0 Votes
    3 Posts
    82 Views
    thomthomT
    Sound more like the model isn't modelled with their normals correct. All 3D software tools will use cause odd results of the normals in the mesh isn't modelled correctly.
  • Can page/scene creation be undone in undo/redo system?

    4
    0 Votes
    4 Posts
    173 Views
    T
    That's the usage I put in - with the second parameter 'true'. It does indeed speed up making many scenes, quite noticeably. I haven't fully characterised how many scenes need to be undone to cause a crash (EDIT - I said originally 'kill' and I realised you might be thinking 'slow down horribly' rather than crash, burn, quit rudely etc) but since 'a few' works OK (except for the damned pages staying in place instead of going away) and 'a few dozen' crashes, I guess it's somewhere in the middle.
  • Closing an open component API

    7
    0 Votes
    7 Posts
    160 Views
    Dan RathbunD
    @tim said: Yeah but you know what it's like - Yes I've been there. Was just teasing. And it takes awhile to get used to how they organized the API.
  • Getting the &quot;circle steps&quot; ???

    11
    0 Votes
    11 Posts
    209 Views
    M
    @tig said: My "ArcCurve-set_segments" tool lets you change the segments of selected Arcs, just as you could using Enity Info on each one... you are also bound by the same limitations - e.g. you can't change the segments if the Arc is part of a 3d object... Argh, that's exactly what I was envisioning to do (a 3D object application). Well it makes sense that it cannot be done on the volume by changing the segments of the generating geometry. I didn't think of that. Thanks for the answers.

Advertisement