sketchucation logo sketchucation
    • Login
    1. Home
    2. Frankn
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    F
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 26
    • Posts 103
    • Groups 1

    Topics

    • F

      Get coordinates of nested components

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      4 Views
      Dan RathbunD
      @fredo6 said: For instance, if you pick interactively the nested component, the PickHelper will give you the chain of grouponents. Expanding upon this use of the PickHelper class ... This is using the Sketchup::PickHelper#path_at() method. It returns the instance path from the active entities context (for the given index in the list of pick paths.) To get the full path, you will need to add the pick path to the model's active edit path (if it is not nil.) edit_path = model.active_path ? model.active_path ; [] full_path = edit_path + pick_path Then, you can use a little known method in the InstancePath class to get the transformation ... ipath = Sketchup;;InstancePath.new(full_path) trans = ipath.transformation See: Sketchup::InstancePath#transformation
    • F

      How to replicate change axes

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      3k Views
      No one has replied
    • F

      Best practices for creating an rbe

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      7k Views
      F
      Where can I find info and/or examples on how to set this part of the loader file? I'm searching but not finding anything... require "Author_MultiClassPlugin/MultiClassPlugin_SharedConstants.rb" include SharedConstants # mixin the constant module And this from the SharedConstants file? SOME_SEARCH_PATTERN ||= /^Author/ Thanks
    • F

      Win32API is deprecated after Ruby 1.9.1

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      8k Views
      Dan RathbunD
      This is not an error. It is a warning. Prior to Ruby 2.x, Win32API was a compiled .so file. Then they (the Ruby Core project) deprecated it and began (with Ruby 2.0 in SketchUp 2014 thru 2016) distributing Ruby with a " Win32API.rb" wrapper file that defined wrapper calls using the DL standard library. But later on (by Ruby 2.2.4 with SketchUp 2017 and higher,) even the DL standard library was deprecated, and the " Win32API.rb" wrapper file was rewritten to change the DL library calls into Fiddle library calls. So even now with Ruby on the latest SketchUp, we would still expect old Win32API method calls to be translated correctly into Fiddle library calls. The warning cannot be suppressed as it is stated at the top of the " Win32API.rb" wrapper file without condition. You will see it output to the console by the first extension that calls a require "Win32API". Okay, but there is always a chance things could have been broken as changes to the Fiddle library might change with Ruby version changes. The latest SketchUp 2021 is now up to Ruby version 2.7.2. SketchUp 2020 was using Ruby version 2.5.5. Did you see differences between loading under these 2 Ruby versions ? I would suggest using a Ruby Console opener like Eneroth's to see what other errors are output to the console. It is best when troubleshooting to switch off the extension so it does not load at startup, and then manually load it with the console open to see any other errors.
    • F

      Moving a curved face/surface

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      5k Views
      F
      Found this post which helped me find the solution... https://forums.sketchup.com/t/transform-a-model-vertex-by-vertex/38771/7 Here's the code I'm using with some notes... if something can be improved or changed please let me know? I can also add the code to iterate the faces if needed? Basically you need the vertices of all the faces you want to move and each vertex needs a cooresponding vector to be moved to. That way you can pass the 2 arrays to transform_by_vectors(vertices, vectors) . Andif you're using sub components like I am, make sure you're in the correct entities context (not sure I'm using all the proper terminology here) oe else you get a mess as a result. Like Tig explained in the post I shared... @unknownuser said: ... if every vector has a separate vector-transformation you need to pass two full arrays - in one go! vectors=[] //array of position to move vertices vertices=[] //array of face vertices from the individual faces that make up the surface vertices.flatten! //in my case I need to flatten the array vertices.uniq! //make sure there are no duplicate vertex vertices.each{|vector| position=vector.position.clone position.x +=distance vectors.push vector.position.vector_to(position) } component_entity.transform_by_vectors(vertices, vectors) Hopefully this helps others out because it wasn't easy to find or understand... but it works!
    • F

      Undoing all transformations

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      4k Views
      F
      Thanks for all that info fredo... It'll certainly come in handy
    • F

      Ruby not returning correct dimensions

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      1k Views
      TIGT
      You have found your own solution.
    • F

      Move component diagonally and rotate

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      387 Views
      S
      If you are using the Ruby API, Geom::Transformation.translation followed by Geom::Transformation.rotation.
    • F

      Working with millimeters

      Watching Ignoring Scheduled Pinned Locked Moved Woodworking
      4
      0 Votes
      4 Posts
      1k Views
      G
      I work with millimeters and imperial and I don't round. When I work in imperial I would cut a 4" nailer When I work in metric it would be a 100mm nailer I will check the thickness of panels and adjust them to 1 decimal in mm. I keep imperial and metric standards.
    • F

      Getting angle relative to component

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      234 Views
      No one has replied
    • F

      Retrieving bounding box corners Point3d

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      447 Views
      F
      @thomthom said: The BoundingBox object you get when you query the instance will always be oriented to world space. To get the bounding box as drawn in the UI you need to get the bounds of the definition - fetch all the points from its corners and transform them using the current edit_transform and the selected instance transform. That extension I linked to does all that. Ah! Thanks for the explaination ThomThom! I didn't realise that's what happened with instances' bounding boxes...very confusing for a novice! I did take the time to check out your extension and was able to understand what you're doing and apply that to my own code... thanks again sir!
    • F

      Escaping out of editing a component

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      4
      0 Votes
      4 Posts
      340 Views
      tt_suT
      Note that if only close the currently open instance. If you are deeply nested you need to loop until you are back in the root - (if that's what you desire). And before SU2014 the method was bugged and could mess up geometry if the close was undone. (The method actually creates an undo item)
    • F

      Iterate selection

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      3
      0 Votes
      3 Posts
      337 Views
      F
      Thanks Anton_s! Even though I'm still trying to figure out what and how your code works it does work perfectly!
    • F

      Sketchup2014 - undefined method `GetString'

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      12
      0 Votes
      12 Posts
      3k Views
      Dan RathbunD
      @frankn said: As far as using .GetString or [], does .GetString still work in 2014 so that it's compatible with older versions of Sketchup? Yes the renamed the getter method [], then aliased it as GetString.
    • F

      Using each_slice possible?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      10
      0 Votes
      10 Posts
      986 Views
      Dan RathbunD
      You get a NoMethodError because Enumerable does not have that method defined in Ruby 1.8.x. This should do the same, except you pass the array in as the 1st argument: def slicer(ary,num) a2 = ary.dup len = num.to_i.abs until (s = a2.slice!(0,len)).empty? if block_given? yield(s) else puts(s.inspect) end end # until end # slicer() See another example that will collect the slices into an output array, IF a block is NOT given. (Sort of like the opposite to flatten().) If a block is given, it returns an array of the block's return values. Prints to $stdout only if $VERBOSE == true. Fixed absolute call. It is not a Math module function. It is a standard Ruby Numeric instance method.
    • F

      Pushpull/move a component instance's face

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      12
      0 Votes
      12 Posts
      453 Views
      F
      @unknownuser said: ](http://www.sketchup.com/intl/en/developer/docs/ourdoc/face#reverse!) I had seen that but I never tried it thinking it was like the Skethup function 'reverse faces' which turns the face from purple to white. No I guess not... that will change the faces for ALL instances. (Remember that it is the Definition that owns the component entities, not the instances. ALL instances share the same entities collection from their parent definition.) Actually that works in my situation because I make all my instances unique... but I'm just starting to play around with this and might run into problems later. edit: just took a closer look at my model and yes it does turn the face from white to purple doing exactly like the Sketchup function. So yes it works but not the ideal solution.
    • F

      Retrieving parent definition

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      13
      0 Votes
      13 Posts
      1k Views
      F
      @chris fullmer said: Frankn, just to clarify for myself, but you really want only components that have sub-components in them? or is it that you want a list of definitions whose instances are NOT sub-components? Hey Chris, I wanted to be able to find the parent definition of components with subcomponets that aren't in the model but still in the definition list. Hope that makes sense... but if it doesn't, basically the 2nd code that Tig shared is what I wanted to accomplish.
    • F

      Hightlight/select component with mouse over

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      7
      0 Votes
      7 Posts
      823 Views
      F
      WOW! Thanks sdmitch!! That's way over my pay grade, Damn! I tested it and it works great, though I must admit I'll have to study the code a lot to figure out how you did it and even then I'm not sure I'll get it.
    • F

      Scaling a component with subcomponents

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      12
      0 Votes
      12 Posts
      214 Views
      F
      Hey Fredo6, I actually mentionned you plugin in my other post and how I was trying to figure out how you did it. Only problem is you're a ruby/sketchup god and I'm more of a peasant. Thanks to Chris, I now know that what I'm trying to accomplish is called parametric modeling, learn something new everyday . So I did a search for that and came up with this file parametric.rb (attached) and a couple of interesting websites, though I haven't had a chance to go through them so I apologize if they aren't that good. http://drivingdimensions.com/SketchUp/FAQ/ http://www.sketchup.com/intl/en/download/rubyscripts.html [EDIT: attachment removed by admin]
    • F

      Trouble understanding how Dynamic Components are created

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      118 Views
      F
      Hi Chris, @chris fullmer said: Well then, the bigger question is does you component need to be compatible with the built in dynamic component webdialog, like for others to interact with it. I didn't think of that since I assumed the way of doing this was through Dynamic Components. So I'm not sure what being compatible with implies the DC webdialog implies either way. @unknownuser said: There is no need to actually make a "dynamic component" to do what you are asking. There is a lot that goes on behind the scenes of dynamic components. If all you want to do is manipulate components using your own webdialog, I'd recommend not using the term dynamic component a that confuses the question with the actual dynamic components. Gotcha, knowing that now, yes that's exactly what I'd like to do is being able to manipulate the created components. eg: height, width, depth... along with other variables I have. And being able to do so to all the components or just selected ones. @unknownuser said: The way I see it is that you have 2 main issues to tackle here. 1 - You need to learn how to work with components, and scale them or manipulate their geometry. You can learn this without the trouble of a webdiloag first. I have a pretty good handle on creating components already but manipulating tham after they've been created is another story which is what my original question should of been. @unknownuser said: 2 - You need to master is how to converse freely back and forth from ruby and your web dialog. Once you get them talking, and you know what you need to do to your components, then its easier to understand how to put your webdialog together so it can reach into the model and make changes. I've got the initial communication between WD and ruby working just fine. Actually My plugin is built with WD and also works great, well it needs a few 'fixes' but I'm able to get all that done, as best as I can for a newbie at lest. But getting my WD to then modify or manipulate as you say the components I create is a whole other story! I fugured integrating DCs was the way to go but seems like there are other ways of doing so. That being said, from your reply maybe I should look into scaling my components? Or resending new values and some how applying them to existing components and redrawing? Am I even close in my assumptions? Thanks, Frank
    • 1
    • 2
    • 1 / 2