⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

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
  • Problem with group.copy

    20
    0 Szavazatok
    20 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    @thomthom said: hm... I'm tempted of adding a script that loads first that freezes the base ruby and SketchUp classes and modules just to see what happens. Could be useful to catch misbehaving plugins. Problem is that Ruby is designed to allow this by people who know what they are doing. Many of the Extended ruby Library files add needed methods to base classes, or modify some methods (RubyGems is an example that modifies the global require method, although I never understood why it really needed to do it.) Even though methods are objects, it is difficult to get a reference to an instance method within the class definition (very easy within an instance of the class.) So it is hard to freeze particular instance methods class-wide, without freezing the whole class or module. (Perhaps the gurus on the Ruby Forum know a trick?) An alternative would possibly be (untested): class Sketchup;;Group # Make a copy of method ;copy alias_method(;_copy_,;copy) def self.method_added(sym) # # callback called by Ruby when a new method is defined; # alias_method(;copy,;_copy_) if sym == ;copy # end end EDIT: method_added is a class callback, so must be defined using def self.method_added(sym)
  • Intersecting line with BoundingBox

    10
    0 Szavazatok
    10 Hozzászólások
    814 Megtekintések
    A
    I hadn't considered that because planes are infinite, but it works well combined with BoundingBox.contains? def intersect_line_boundingbox(line, bb) # Intersect with 6 planes of the bounding box's sides. p0 = bb.corner(0) p1 = bb.corner(7) [ [p0, X_AXIS], [p0, Y_AXIS], [p0, Z_AXIS], [p1, X_AXIS], [p1, Y_AXIS], [p1, Z_AXIS] ].each{|plane| intersection = Geom;;intersect_line_plane(line, plane) # Stop when the intersection point is inside the bounding box. return intersection if bb.contains?(intersection) # else continue } # No intersection (because bb is aside line or behind line start). return nil end There is certainly room for optimization (ie. maybe less than 6 planes, or checking whether BB is behind line start). I first had the code with an infinite straight line (starting from -infinity) and only one intersection with a plane but that failed due to precision errors.
  • Intersecting and Attribute inheritance

    12
    0 Szavazatok
    12 Hozzászólások
    851 Megtekintések
    TIGT
    Put very simply we need to see what face is under what point. We find all of the 'combined faces' in group3 [after the explosion of copies of group1 and group2 we added into it] - an array which I named faces3. Each face in faces3 has vertices, we consider the first one in each case = vertices[0], we find it's .position, we offset that position a little and rotate it around the Z_AXIS and the vertex.position by steps of 1.degree until we know it's on the 'face'. That's the classify_point method. So now we have a point we know is on the face. We test all of the faces in faces1 until we get on that 'contains' the point - we remember its 'Plot' attributes. We test all of the faces in faces2 until we get on that 'contains' the point - we remember its 'Zone' attributes. We add new attributes [Combo] to 'face' combining these two sets of attributes... You could probably do with testing group1 and group2 faces for both attribute dictionaries, since you can't be sure which group is which in the selection - unless they have 'names' that tell us?
  • UI::WebDialog => set_html => large HTML pages

    12
    0 Szavazatok
    12 Hozzászólások
    2k Megtekintések
    N
    Thanks guys for the hints! I got a message from Noel!
  • Mysterious change of group bounding box coords

    3
    0 Szavazatok
    3 Hozzászólások
    242 Megtekintések
    sdmitchS
    thomthom, Thanks for the help. The solution was to obvious I guess.
  • Using win32ole on startup

    14
    0 Szavazatok
    14 Hozzászólások
    971 Megtekintések
    S
    @thomthom said: For timer delay you should immediately stop the timer in it's block - because if a modal window appear within the block, like a messagebox or an error message (which you get when you start SU) will make the timer repeat until the modal window is closed. <span class="syntaxdefault"><br />timer </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_timer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">false</span><span class="syntaxkeyword">){<br /></span><span class="syntaxdefault">  UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">stop_timer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">timer</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># ...<br /></span><span class="syntaxkeyword">}<br />&nbsp;</span><span class="syntaxdefault"></span> Hi Thom and TIG, that's exactly how ì solved it. Noticed the fact that a UI.messagebox in the block will make the timer repeat too. Never used UI.start_timer before but I can think of some nice implementations of it.
  • Purpose of Single Line Consoles for Ruby?

    10
    0 Szavazatok
    10 Hozzászólások
    843 Megtekintések
    thomthomT
    @chris fullmer said: I think I can see that I'm conflating the concepts of editor vs. console. If so, I guess I only see the need for a built in simple editor, and I don't comprehend what a single line console is good for. I think this is the key here. You use it to develop plugins / snippets directly into SketchUp. (Which makes sense as you get a direct result.) Personally I'm too paranoid that SketchUp crashes and bye-bye goes all my work. And I have grown to rely heavily on the features Notepad++ or Sublime2 gives me that I always write my code in an editor. I use the console for debug output, reloading, and minor testing (multiple command over multiple lines, or multi-command-one-liners.) (Btw, isn't it Shift+Return for the new-line in the SU developer console?)
  • [API] Menu.add_item( caption, index )

    8
    0 Szavazatok
    8 Hozzászólások
    742 Megtekintések
    J
    Just confirmed it does work in sub-menus. [image: 2012-11-04_134125.jpg]
  • WebDialogs - The Lost Manual — R1 09 November 2009

    43
    0 Szavazatok
    43 Hozzászólások
    26k Megtekintések
    thomthomT
    hm.. interesting. Wasn't aware of this Pages feature. Nice.
  • Losing focus on window

    2
    0 Szavazatok
    2 Hozzászólások
    636 Megtekintések
    thomthomT
    Some times the toolwindows get the focus. Say if you undo a change where you edited a material in the Material Editor - SU will send the focus back to that window. Annoying.
  • Scaling a component with subcomponents

    12
    0 Szavazatok
    12 Hozzászólások
    744 Megtekintések
    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]
  • Creating a nested component

    4
    0 Szavazatok
    4 Hozzászólások
    567 Megtekintések
    TIGT
    Entering a faces edges/vertices 'in order' to add a clone into another context will determine the normal of the new_face. But it's always possible that the original face has been reversed if you took the edges ? So get the original_face.normal and compare it with the new_face.normal [allowing for the transformation differences!] - then if they don't match you must reverse the new_face...
  • [Code] Progress bar with tasks

    2
    0 Szavazatok
    2 Hozzászólások
    194 Megtekintések
    renderizaR
    This looks very interesting...Thank you both!
  • Edit Watermarks by code?

    3
    0 Szavazatok
    3 Hozzászólások
    220 Megtekintések
    renderizaR
    I was hopping there was more functions regarding watermarks with the API, maybe in SketchUp 9 who knows. For creating water drops on screen I guess I can still make it work by animating the Scene Manager to desired style. Thanks
  • Trouble understanding how Dynamic Components are created

    5
    0 Szavazatok
    5 Hozzászólások
    318 Megtekintések
    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
  • [API] curve.move_vertices

    10
    0 Szavazatok
    10 Hozzászólások
    625 Megtekintések
    thomthomT
    @mptak said: If I apply a transformation to the separate vertices in an circle or arc it acts differently than if I have exploded the curve. Any insights? When the vertices are a part of a circle the circle seems to dilate about the center even if the transformation is defined as tran=Geom::Transformation.new([0,0,10]) If the curve is exploded the transformation does the expected shift of 10 in the "z" direction. Thanks for any immediate insights. In Vertex Tools I had to explode all curves for the vertices I wanted to move. Weird things happen when you move vertices connected to a Curve. I have never tried Curve.move_vertices though...
  • Intersect_with group with model

    3
    0 Szavazatok
    3 Hozzászólások
    243 Megtekintések
    S
    Thanks TIG! The problem was indeed the last argument, I put an entities object in there. working with an array instead did the job
  • What is the right and wrong way to sell your plugins?

    9
    0 Szavazatok
    9 Hozzászólások
    820 Megtekintések
    renderizaR
    Hi, I was testing the process of screen capturing the animation with Active Presenter and I am not so happy. The resolution setting had to be very low because if not the resulting video would have lagged very bad even though inside SketchUp there was no lag at all. http://www.youtube.com/watch?v=6RGFwNHLfpo Renderiza
  • Web Dialog: Trouble passing string from ruby to javascript

    4
    0 Szavazatok
    4 Hozzászólások
    2k Megtekintések
    S
    Thank you very much it works just fine
  • Plug In - Copy to Path troubles

    9
    0 Szavazatok
    9 Hozzászólások
    783 Megtekintések
    nikusknxN
    Ok I get the good position with a translate: definition.instances.each do |instance| originBefore = instance.transformation.origin instance.transform! inv tr = instance.transformation vectorTranslate = originBefore - instance.transformation.origin translate = Geom::Transformation.translation(vectorTranslate) instance.transform!(translate) end but when the axes changes (y axes become z axis for exemple) the scale are not good and switch... I try to get the model.edit_transform , manualy I can get it but with the API it's always the same problem : I can't do the right click Component edit... Any Idea to get the local axes?

Advertisement