ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • JQuery 1.5 Released

    3
    0 Votes
    3 Posts
    316 Views
    thomthomT
    @jim said: jQuery 1.6.2 released. Beware to read the change notes from 1.5.x to 1.6.x if you are upgrading.
  • Groups

    15
    0 Votes
    15 Posts
    218 Views
    TIGT
    Please don't reuse references or confuse them with methods etc - coding is complicated enough as it is I suggest you prefix new groups with a single meaningful letter, and suffix their entities with 'ents' So 'sgroup' > 'sents' and 'rgroup' > 'rents' etc. Then any other reference to 'step' or 'rail' will pass without incident... And you can easily spot the relationship of s=step and r=rail For example, I always call my temporary group 'tgroup' and its entities 'tents'.
  • Window handle from process

    37
    0 Votes
    37 Posts
    3k Views
    Dan RathbunD
    @tig said: Can't you can simply .... After having explained that using the title bar text is problematic (and subject to a bug while loading on Windows,) you still advise doing it? Again, the "Untilted" string is NOT the same on all language localizations, and some contain unicode characters. It's also possible that a SKP filename could contain unicode characters. Then you add two more situations that can "throw a shoe in the works". @unknownuser said: **, the designer and original implementor of C++":37wih2kn] "If you think it's simple, then you have misunderstood the problem" [floatr:37wih2kn]Did you really really say that? - Bjarne Stroustrup's C++ FAQ[/floatr:37wih2kn]
  • Requiring Socket on Mac crashes SU

    12
    0 Votes
    12 Posts
    1k Views
    Dan RathbunD
    @jhyuk said: Thanks a lot!!! I was able to change the symlinks and make it use 1.8.7 of the mac and copied the socket.bundle from that version and everything is working fine!! Now wouldn't it be nice if Sketchup had a button that you could press or a checkbox and it automatically used your full system Ruby install instead of that old v1.8.5 initial dead release ??
  • Draw on face

    4
    0 Votes
    4 Posts
    246 Views
    TIGT
    A line added in code will NOT split a face/edges unless you call some sort of entities.intersect_with() method... If the line is being added in in code you can check the picked points with a pick_helper to see if a face is picked under the point. Then you know the face is under a point, what the face is and then check that both points are on the same face ? http://code.google.com/apis/sketchup/docs/ourdoc/pickhelper.html#picked_face
  • NURBS plugin version 0.1

    28
    0 Votes
    28 Posts
    3k Views
    thomthomT
    @unknownuser said: How is thomthom doing the Bezier Surface? Ruby only? Currently in Ruby. But once I get things working and I can start profiling I'll probably move some stuff into a C Extension to do the main bulk of the bezier calculations etc.
  • SketchUp API Blog - Extensions

    7
    0 Votes
    7 Posts
    175 Views
    Dan RathbunD
    @aerilius said: Since I'm relatively new to ruby/plugins, I haven't yet dared to propose SketchupExtension in the Plugin-Installer-Tool discussion, I did. I asked Dana to have a look at my example, in another topic. @aerilius said: ...but also because I had the impression that in its current state, it is neither useful to users nor was I sure whether it's well designed (I can not really judge about that). Well, there is a difference between the Ruby functionality, and the Application UI functionality. Most users hate the Preferences dialog panel interface, for several reasons: Too small, only shows limited number in the list.* Panel cannot be sized.* The amount of attribute data displayed is fixed.* The list cannot be sorted (it's shown in load order.) Now... the Ruby functionality issues (or short-comings,) have prevented others from creating a better manager. The most glaring is the one Dana is working on, that is "one-click" installation and updating. This is also the number one complaint. @aerilius said: I think it's important for this discussion that we know if it's necessary to invent our own "standard" how to manage/disable plugins, It's more important that rubyists use a common class, that can be extended. For instance, we already have the issue where some plugins are Smustard Organizer compatible, but not SketchupExtension compatible, and visa versa. There are quite a few plugins (a most all of the Google authored plugins,) that already use SketchupExtension class instances. It does make sense not to orphan them. @aerilius said: or if SketchupExtension could once become a serious possibility (with some overhaul ). YES, and I've already done an overhaul, for my own use, and proved to myself that the class can be improved greatly (and the few current bugs fixed.) BUT.. I don't "own" the class, it's a standard API class, so I can't release the code. I have about $2500 labor into it, and was wondering, if anyone would be interested in donating toward it. If a "donation piggybank" reached that amount I'd release it. (I wonder if I can convince 100 people to donate $25, or 2500 to donate a buck?)
  • Unicode characters problem

    9
    0 Votes
    9 Posts
    267 Views
    voljankoV
    The problem was in the file,not in the code. I have saved the file in notepad as UFT-8 ,so I can "unpack" the character. I have tried to save the file in other formats (unicode,ANSI,unicode big endian) and is always giving me errors. So only UFT-8 is ok. Problem solved
  • Methods from Support files

    6
    0 Votes
    6 Posts
    212 Views
    TIGT
    Moved.
  • Ruby How to Select All Connected

    6
    0 Votes
    6 Posts
    2k Views
    TIGT
    I've moved this into the Developers' Forum as it's a general issue... You can get info about a curve. verts=curve.vertices returns the vertices, so if it's an arc etc then vf=verts.first and vl=verts.last are the end vertices. You can also get the start and end edges with ef=curve.first_edge and el=curve.last_edges You can get the edges that use any vertex with edges=vertex.edges so do that for vf and vl in turn - the array of edges will include the curve's edge so fedges=vf.edges; fedges.delete(ef); fedgeyouwant=fedges[0] ditto for vl/ el So you now have a way to find the two edges connected to ends of an curve. This assumes you have checked it's a curve, it's not looped etc; and if there isn't a connected edge you get 'nil'. or if there are more than connected edge then only the first one found is returned...
  • Web Dialog not firing a JavaScript function...

    14
    0 Votes
    14 Posts
    3k Views
    thomthomT
    Yes, one has to use a combo. If you look at the jQuery source you see the various methods they use to make it cross platform compatible. onReadyStateChange is used as a fallback for older IE versions. Mozilla, Opera, Webkit and newer IE use DOMContentLoaded. http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Default.html
  • How can one calculate the smoothness of a bezier curve?

    11
    0 Votes
    11 Posts
    613 Views
    thomthomT
    @mac1 said: What criteria is used to determine smoothness is good enough?? RMS error or?? I was thinking that, from a user's point of view, one set a max angle. That the segments connecting each other would not exceed this max angle. Though, I am open to other definitions.
  • How to convert String to Path?

    10
    0 Votes
    10 Posts
    924 Views
    TIGT
    Thomthom you are right! Here is a fixed version if (pth=model.path).empty? ### do stuff with an alternative path else ### do stuff with 'pth' as it's not empty end
  • Bug Splat on erase!

    11
    0 Votes
    11 Posts
    424 Views
    voljankoV
    But also Dan's suggestions have positive results: In the activate method of the tool I have put the Sketchup.active_model.start_operation "myTool",true,true,false And I have put the Sketchup.active_model.abort_operation in the deactivate method of the tool and in the onPreSaveModel model observer. Now the group is disappear before saving the model. Thank you both.
  • Copy selection to new group?

    8
    0 Votes
    8 Posts
    2k Views
    TIGT
    Once you have the group you can get a reference to its definition defn=group.entities.parent It acts just like a normal component definition. So then use group2=model.entities.add_instance(defn, group.parent.transformation) [you must check it's not already in the model - if it is use group.transformation] then group.erase! So the collection is now called ' group2' and it is in model.entities...
  • Model observer problem

    3
    0 Votes
    3 Posts
    224 Views
    voljankoV
    Yes,I have thought about this right after sending my post,but want to test first. Now it is working ok and sorry for blaming observer for this problem. So this is the working code: class MyModelObserver < Sketchup;;ModelObserver def onPreSaveModel(model) UI.messagebox("onPreSaveModel; " + model.to_s) end end # Attach the observer. Sketchup.active_model.add_observer(MyModelObserver.new) class MyAppObserver < Sketchup;;AppObserver def onNewModel(model) UI.messagebox("onNewModel; " + model.to_s) Sketchup.active_model.add_observer(MyModelObserver.new) # Here is where one might attach other observers to the new model. end def onOpenModel(model) UI.messagebox("onOpenModel; " + model.to_s) Sketchup.active_model.add_observer(MyModelObserver.new) # Here is where one might attach other observers to the new model. end end # Attach the observer Sketchup.add_observer(MyAppObserver.new)
  • Mouse Capture (Win32 API)

    13
    0 Votes
    13 Posts
    4k Views
    M
    So here is the jist of Anton's code: Capture mouse (Sketchup will stop reacting to it): getForegroundWindow=Win32API.new("user32", "GetForegroundWindow", [], "L") Win32API.new("user32", "SetCapture", "L", "L").call(getForegroundWindow.call()) Read all key states (keyboard and mouse): @getKeyboardState=Win32API.new("user32", "GetKeyboardState", "P", "V") @lpKeyState=" "*256 @getKeyboardState.call(@lpKeyState) @lpKeyState will hold an array of 256 numbers for all the keys. @lpKeyState[1,2,4] - [1]left-mouse, [2]right-mouse, [4]middle-mouse @lpKeyState[48..57] - keyboard keys 0 to 9 Release mouse Win32API.new("user32", "ReleaseCapture", "V", "L").call()
  • Parent instance of a component

    13
    0 Votes
    13 Posts
    1k Views
    voljankoV
    My intention was to write and read some attributes to some groups and components. After writing it to components (instances) ,it was impossible to read the attribute of the parent component(or group). To resolve it,I have decide to write and read only to definitions of the components. Now,before I write or read to entities, I check if the entity is group or component. If it is a group,I read and write to this entity,if it is a component,I read and write to the definition of this component.In this way,I don't need to know the exact parent instance of the component,because all the instances have the same attributes. So the problem is resolved
  • Distortion?

    5
    0 Votes
    5 Posts
    264 Views
    P
    I think I found a way to do it =). I just project the geometry onto a curved surface. Than I export the view as 2D dxf. So,the imported dxf contains the distorted geometry. The distortion value can be controlled by the fov of the camera.
  • Issues with the onMouseMove method within a Ruby Tool

    7
    0 Votes
    7 Posts
    439 Views
    TIGT
    Why ask me? You are the one with all of the code... Just test it. You need to call your method self.draw_beam() within the onMouseMove method - probably after you've test for a certain 'state' being reached - e.g. perhaps initially 'draw_beam' doesn't kick in with @state=0, but after you have done some other stuff when you've then set @state=1 - then in the onMouseMove method the line would be self.draw_beam() if @state==1 etc, later on, perhaps after you click again, you'd set @state=2 so then the 'draw_beam' stops...

Advertisement