🚨 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
  • Weird DimensionLinear behavior

    5
    0 Szavazatok
    5 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    @ittayd said: Thanks, I'm asking about ways to interact with the text: getting, setting. No this is not what you asked! Such a simple thing (as what method's a class has) can be easily found by looking at the API dictionary. http://ruby.sketchup.com/Sketchup/DimensionLinear.html ... which is a subclass of (and therefore inherits methods from http://ruby.sketchup.com/Sketchup/Dimension.html ... which is a subclass of (and therefore inherits methods from http://ruby.sketchup.com/Sketchup/Drawingelement.html ... which is a subclass of (and therefore inherits methods from http://ruby.sketchup.com/Sketchup/Entity.html ... which is a subclass of (and therefore inherits methods from http://ruby-doc.org/core-2.2.4/Object.html You asked about dims nested inside transformed instances. I am not sure if the .text getter will return transformed lengths or not. Also not sure what happens when the context is open and not. So test. The means I showed above avoids the conversion of text ( String) into a numeric ( Length) object, and just gets the length.
  • Bounds change depending on active context?

    5
    0 Szavazatok
    5 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    @ittayd said: And, I wouldn't mind the coordinates changing if contains? would have acted sanely, always returning true to a point that is inside the group BoundingBoxes are always aligned with the model's axes. This means if you rotate a cuboid instance, it's bounding box will increase. The second thing you need to realize is that bounding boxes have an untransformed state (ie, the definition's entities bounds,) and each of their instances transformed bounds. The transformed bounds are not just translational, they can also be affected by the rotation and scaling of the instance. @ittayd said: I would expect the coordinates to never change no matter what entity is opened. As a coder, most of time when generating geometry, you are just working in the definition's local coordinates with the IDENTITY transform, (ie, everything is 1:1 and you're specifying geometry oriented in relation to the definition's local origin and axes.) But when the user double-clicks into an instance, that might be rotated or scaled (transparently they are actually editing the definition,) but perhaps not at the 1:1 scale. Imagine an instance that has been scaled 2x. The user would be drawing edges that are twice as long on the screen. So their needs to be some transforming back to the definition's scale and coordinates. Julia wrote a really good explanation of this recently (ie past few months.) Need to find this and give you the link.
  • Mass material importer

    14
    0 Szavazatok
    14 Hozzászólások
    10k Megtekintések
    C
    Thanks a lot guys for the tips ! the script work fine. But really no one have any idea how to batch-adjust the tiling of the material ? Other ways it will take me days to manually adjust each one of them (I have like 500 skm tu adjust)
  • Ruby Group Copy - Regardless of Context?

    6
    0 Szavazatok
    6 Hozzászólások
    2k Megtekintések
    H
    Thank you Dan!
  • Flags parameter in a tool's onKeyDown/Up

    12
    0 Szavazatok
    12 Hozzászólások
    3k Megtekintések
    Dan RathbunD
    Ah okay, 3 years and two months ago, Fredo was noticing these same issues in the following topic thread: onKeyDown: getting the charcater value from key In that thread, post # 9, I noted several other related topic threads, and the one that I just remembered by Jim Foltz, which was back in 2009. flags on onKeyDown? (Note that at this time Chris Fullmer was not yet a member of the SketchUp Team, and had not yet learned much programming.) See other related threads: My Apple Keyboard VK_KEYS very difficult key codes! keycodes intelmac Jim's KeyTool.rb is also posted in this topic thread, but not sure if it is the latest version ? Key sequence in ruby Now, @Anton_S posted a Windows only method that calls Windows API C functions, in this post: http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=57450%26amp;p=522915%26amp;hilit=keytest#p522915
  • Get mac address in ruby

    8
    0 Szavazatok
    8 Hozzászólások
    2k Megtekintések
    B
    Thanks that works
  • Axes question

    8
    0 Szavazatok
    8 Hozzászólások
    2k Megtekintések
    PixeroP
    Thanks for the info.
  • Handling advanced selection in a tool

    4
    0 Szavazatok
    4 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    @ittayd said: Is there a way to utilize sketchup's own selection tool? The only way is to attach a SelectionObserver, activate SketchUp's native SelectTool Sketchup.active_model.select_tool(nil), collect the object references, detach the observer, and activate your tool. But trying to leverage native tools via code has been problematic in the past. So, this is why they finally added (SU2016) the two window pick methods to the PickHelper class. ThomThom wrote a tutorial and created a graphic helper chart for using this class. http://www.thomthom.net/thoughts/2013/01/pickhelper-a-visual-guide/ Other than that, you best learn by reading the example extension by the SketchUp Team (EW) or others like ThomThom's plugins.
  • Rotate a component before place it with a key imput

    2
    0 Szavazatok
    2 Hozzászólások
    1k Megtekintések
    Dan RathbunD
    @boom02 said: Do you guys think this is the right way? NO. The spacebar is pre-coded to activate the native SelectionTool. Many users are used to it this way, and do not want to change it. Those that have changed it, have done so for their own choice of command. Secondly, you cannot affect how the built-in place_component works as it is a native tool, most especially not when using the repeat mode. (Ie, there really is no way to trap the spacebar and prevent it from bubbling-up to SketchUp's shortcut handler.) The way it is designed, when not in repeat mode, is that once placed, the normal MoveTool is active, and it's hover rotate mode can be used. Just hover the MoveTool cursor over a the side of a component's bounding box, and 4 rotate handles will appear. Move to one of the handles and you'll see the cursor change to a protractor. I myself, also kinda miss the ACAD spin before place feature. @boom02 said: ... how can I get the key press from the user? The best way is inside a custom tool class written in Ruby. http://ruby.sketchup.com/Sketchup/Tool.html And you'd need to create a menu item pointing at a method object that rotates the selected object. Then that menu command can be assigned any shortcut, by users according to their own desires.
  • Trouble adding entity to component definition

    6
    0 Szavazatok
    6 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    A workaround we employ is to stick a temporary cpoint into the entities (at it's origin,) and then delete it later after we've loaded it up with geometry. The temp cpoint stops SketchUp's garbage collector from deleting the object.
  • Importing Bulk Attribute Values from CSV

    11
    0 Szavazatok
    11 Hozzászólások
    2k Megtekintések
    H
    BTW, the answer to the original question was that input = UI.inputbox(@prompts, @defaults, @list, "Select Attribute Target") returns an array of values because typically the inputbox would present more than 1 option. In my case there was only one input or prompt so when I put input into set_result = Sketchup.active_model.set_attribute("dynamic_attributes", input, att_string.to_s ) I was actually sending in an array and thus setting a new key in the format ["whatever user put into inputbox"]. Even .to_s did not seem to help... set_result = Sketchup.active_model.set_attribute("dynamic_attributes", input.to_s, att_string.to_s ) The answer was to get the first item in the array like so: set_result = Sketchup.active_model.set_attribute("dynamic_attributes", input[0], att_string.to_s )
  • Observers WhishList

    59
    0 Szavazatok
    59 Hozzászólások
    117k Megtekintések
    G
    @thomthom said: Would that be at the event of copying? Or when pasting? Can you describe the scenario you'd use it in? when copying i am trying to find a way to control the difusion of dynamic components if such an observer would be available, it would be easy to prevent unauthorized copies selection observer can be used, but it is less direct, and probably less efficient than an observer on copying more dynamic components would be created if there was a way to crypt them, just as ruby plugins
  • Uninitialized class variable

    5
    0 Szavazatok
    5 Hozzászólások
    1k Megtekintések
    PixeroP
    Thanks, that worked.
  • Cleaning up memory in script

    3
    0 Szavazatok
    3 Hozzászólások
    992 Megtekintések
    PixeroP
    Thanks.
  • Replace Several Textures?

    32
    0 Szavazatok
    32 Hozzászólások
    6k Megtekintések
    sdmitchS
    I have PM'd you a possible solution to #7
  • How to create a selection window in a tool?

    2
    0 Szavazatok
    2 Hozzászólások
    913 Megtekintések
    sdmitchS
    @ittayd said: I want to create a tool that allows to select several entities by either picking them or a selection window. But how do I draw the selection window? The "Select by Polygon" plugin you can find on my blog is an example of drawing the selection window then selecting the entities within it.
  • [Req] Dedicated SU onscreen keyboard.

    4
    0 Szavazatok
    4 Hozzászólások
    1k Megtekintések
    J
    Maybe using something like autohotkey, I already use it to map some mouse functions to keyboard, here is a example of a full keyboard: https://autohotkey.com/board/topic/16891-ahkosk-onscreen-keyboard/
  • Fluid freehand

    15
    0 Szavazatok
    15 Hozzászólások
    2k Megtekintések
    D
    the way it works in Preview.app would be good... [image: y5uE_in_preview.gif] john
  • Help please. How to get transformation for the face

    10
    0 Szavazatok
    10 Hozzászólások
    2k Megtekintések
    A
    There it is, TBoy: class BoundsHighlighterTool def initialize @ip = Sketchup;;InputPoint.new @hovered_inst = nil @global_parent_tra = nil @global_bb = nil @labb_global_faces = [] # Faces for the local axes aligned bounding box. @gabb_global_faces = [] # Faces for the global axes aligned bounding box. @labb_global_edges = [] @gabb_global_edges = [] @labb_face_color = Sketchup;;Color.new(255,40,0,80) @gabb_face_color = Sketchup;;Color.new(0,40,255,80) @labb_edge_color = Sketchup;;Color.new(255,0,0,255) @gabb_edge_color = Sketchup;;Color.new(0,0,255,255) @edge_width = 3 end def deactivate(view) reset(view) end def onMouseMove(flags, x, y, view) @ip.pick(view, x, y) ip_path = @ip.instance_path if ip_path.empty? reset(view) return end inst = nil gptra = nil ip_path.each { |ent| break if !ent.is_a?(Sketchup;;Group) && !ent.is_a?(Sketchup;;ComponentInstance) if gptra gptra = gptra * inst.transformation elsif inst gptra = inst.transformation end inst = ent } unless inst reset(view) return end return if inst == @hovered_inst @hovered_inst = inst @global_parent_tra = gptra local_bb = @hovered_inst.bounds # Obtain corners of local axes aligned bounding box in global space lagc = [] for i in 0..7 lagc << local_bb.corner(i) end if @global_parent_tra lagc.each { |point| point.transform!(@global_parent_tra) } end @labb_global_faces = [ [lagc[0], lagc[2], lagc[3], lagc[1]], [lagc[4], lagc[6], lagc[7], lagc[5]], [lagc[1], lagc[0], lagc[4], lagc[5]], [lagc[2], lagc[3], lagc[7], lagc[6]], [lagc[0], lagc[2], lagc[6], lagc[4]], [lagc[3], lagc[1], lagc[5], lagc[7]] ] @labb_global_edges = [ lagc[0], lagc[2], lagc[2], lagc[6], lagc[6], lagc[4], lagc[4], lagc[0], lagc[3], lagc[1], lagc[1], lagc[5], lagc[5], lagc[7], lagc[7], lagc[3], lagc[0], lagc[1], lagc[2], lagc[3], lagc[4], lagc[5], lagc[6], lagc[7] ] # Create global axes aligned bounding box @global_bb = Geom;;BoundingBox.new() @global_bb.add(lagc) # Obtain corners of global axes aligned bounding box in global space gagc = [] for i in 0..7 gagc << @global_bb.corner(i) end @gabb_global_faces = [ [gagc[0], gagc[2], gagc[3], gagc[1]], [gagc[4], gagc[6], gagc[7], gagc[5]], [gagc[1], gagc[0], gagc[4], gagc[5]], [gagc[2], gagc[3], gagc[7], gagc[6]], [gagc[0], gagc[2], gagc[6], gagc[4]], [gagc[3], gagc[1], gagc[5], gagc[7]] ] @gabb_global_edges = [ gagc[0], gagc[2], gagc[2], gagc[6], gagc[6], gagc[4], gagc[4], gagc[0], gagc[3], gagc[1], gagc[1], gagc[5], gagc[5], gagc[7], gagc[7], gagc[3], gagc[0], gagc[1], gagc[2], gagc[3], gagc[4], gagc[5], gagc[6], gagc[7] ] view.invalidate end def draw(view) return unless @hovered_inst # Draw local axes aligned global bounding box view.drawing_color = @labb_face_color @labb_global_faces.each { |face| view.draw(GL_POLYGON, face) } view.drawing_color = @labb_edge_color view.line_width = @edge_width view.line_stipple = '' view.draw(GL_LINES, @labb_global_edges) # Draw global axes aligned global bounding box view.drawing_color = @gabb_face_color @gabb_global_faces.each { |face| view.draw(GL_POLYGON, face) } view.drawing_color = @gabb_edge_color view.line_width = @edge_width view.line_stipple = '' view.draw(GL_LINES, @gabb_global_edges) end def reset(view) return false unless @hovered_inst @hovered_inst = nil @global_parent_tra = nil @global_bb = nil @labb_global_faces.clear @gabb_global_faces.clear @labb_global_edges.clear @gabb_global_edges.clear view.invalidate return true end end # class BoundsHighlighterTool Sketchup.active_model.select_tool(BoundsHighlighterTool.new) This time we iterate through the InputPoint's instance_path and transform the bounding box of the deepest instance across all the the parent groups/component instances in the path.
  • Dynamic Component for holes

    4
    0 Szavazatok
    4 Hozzászólások
    2k Megtekintések
    pilouP
    Perfect many Thx!

Advertisement