šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now
  • Texture exporting from SU

    4
    0 Votes
    4 Posts
    1k Views
    jujuJ
    Whaat, good to see you here at SketchUcation.
  • How the RUBY apply a dimension(with label, dimension line wi

    6
    0 Votes
    6 Posts
    2k Views
    TIGT
    There is a trick that could do this... I'll use 'metres' in the example below but you can adjust this to suit whatever units you want... Make a 1m long dimension (X) against a horizontal edge - in a 'flat' XY orientation, with a 1m long leader offset (Y). Highlight the dim and make it into a component - called let's say 'Dim'. Save it externally as its own 'skp' - into a logical folder path. In a model, your script then inserts an instance of Dim.skp from the folder. In your model/script you have the required edge... The edge has a knowable length (let's say 2.1m), so your script transform scales the instance proportionately by x2.1 in X. The figured dimension will automatically adjust to 2.1m to suit. You can also adjust the leader scale (Y). Transform the instance location and rotation to suit the edge's. You now have a dimension that reflects the edge's length and orientation. You can also use this method to script a 'dimension' between any two known points... You might also be able to change the 'orphaned dim' colour to match the normal dim's colour ? Not sure how to access/set this ??? The dim's arrow heads will scale in the X... too so you might want to make a set of Dim skps - say 1-100mm, 100mm-1m, 1m-3m, 3m-10m etc and then insert instances of them to match nearest to the edge's length - so that the subsequent scaling of them wouldn't distort the dim-compo's arrow heads too much... You could also 'connect' the edge and component-dim using attributes and observers, so if the particular edge changed, then the associated dim-compo could be adjusted automatically to suit... It would then behave very much like a normal associated dimension. This could be all very convoluted to achieve, BUT it's still possible...
  • Is instancing possible?

    11
    0 Votes
    11 Posts
    3k Views
    K
    TIG, Thanks for all this support. I will try that method right away. Regards, kwistenbiebel
  • Anyone able to write 3D XML importer?

    10
    0 Votes
    10 Posts
    7k Views
    M
    First of all, one piece of good news is that I found out that not Dassault, but actually Lattice developed 3DXML, an extention of their own Lattice XML. On websites about Lattice XML I also find the extension XVL bud have not yet found out what that is. One site that looked interesting to me at first sight is http://www.sns.gov/APGroup/appProg/xal/xalDoc/gov/sns/xal/model/xml/LatticeXmlTest.html but perhaps it has nothing to do with this subject. After all it won't do us much good that there are zillions of sites about ordinary XML either. And the best news so far is that I received a quick and dirty triangle only to .obj converter in Python script. So if any of you can read Python (my fav. scripting language, use it a lot in Paintshop) and change it into ruby, that would probably be all we need. -Jim Foltz created an .obj importer for SU, is on scriptspot -I guess most geometry that we would ever like to capture will probably be triangulated -I believe all textures in 3DXML are stored either in their native format or as BMP. Finding binary blocks of data, copying, saving should be easy with any hex editor. [Maggy]
  • Vector.angle_between() -- Direction?

    8
    0 Votes
    8 Posts
    3k Views
    R
    Yeah, sorry about that. I suppose I shoul give it its own spot for developer use
  • How can I assign a keyboard key as a SketchUp shortcut

    4
    0 Votes
    4 Posts
    6k Views
    TIGT
    It IS possible to modify and add shorcuts to the PC registry using SketchUp Ruby methods [search other recent threads on this] BUT I would not recommend it unless it's for 'in-house' use only. As TBD says imagine the chaos it'd cause if your script messed up everyones pre-set shortcuts... IF you want to do this then at least offer the choice - make your script with an installer [part] which checks to see if the shortcut has already been used, and with a dialog that asks something like, "Would you like to assign 'Q' as the shortcut key for this tool ?" and if it's already pre-set, "\nNote that 'Q' is currently used for xxxxxxxxxx."; Yes/No. If Yes then you make / change the shortcut. The installer only auto-runs once - on exiting the dialog it also writes something into the registry that is checked by it when it's about to run again, and if that's found then doesn't even ask. This way the user has the option - and at least then knows that a key has been assigned...
  • Timing script needed for bad timer

    3
    0 Votes
    3 Posts
    3k Views
    S
    Bruce - see the bottom of this thread: Dead Link This is timely- project management software commercially available for free today, but only today - 16 hours left [Shaun Tennant]
  • Sketchup.active_model.layers returns <Deleted Entity>?

    7
    0 Votes
    7 Posts
    4k Views
    R
    I tried your example script, and see the problem you see. According to the SU ruby docs: "Currently there are two behaviors defined. A page keeps a list of layers that do not have their default behavior. If a layer is not in that list, then it is set to its default visibility determined by one of these flags. LAYER_VISIBLE_BY_DEFAULT 0x0000 LAYER_HIDDEN_BY_DEFAULT 0x0001" The strange thing is that in commenting out different lines and trying the script again, LAYER_IS_HIDDEN_ON_NEW_PAGES is the setting that sticks - not LAYER_IS_HIDDEN_BY_DEFAULT. I'll report that to the SU crew.
  • Saved file does not match what's on the screen.

    3
    0 Votes
    3 Posts
    4k Views
    R
    I could take a look - contact me through Smustard.
  • A Ruby to display the name and creator of a ruby?

    2
    0 Votes
    2 Posts
    4k Views
    A
    If the programmers would writing real extensions, you could see name etc. under Windows > Preferences. Would be possible to do this with variables, BUT: The programmers must write classes, not only simple methods including the following module in the way the class MyExtension does: module DescribedExtension @@author = '' @@version = '' # ... end class MyExtension > Sketchup;;Extension include DescribedExtension def initialize @@author = 'azuby' if @@author.empty? @@version = '1.0' if @@version.empty? end # YOUR METHODS HERE end So you can ask the extension for info: if MyExtension.include? DescribedExtension puts MyExtension.author puts MyExtension.version end A much better way would be a kind of manger, which is could from extensions which include DescribedExtension. Than you only have to ask the manager for all described extensions. This is done in my approach to write an extension manager. But unfortunately the Sketchup Ruby API does not provide the required methods to finish my work. But you can go into the sources and look how it is done. azuby
  • Accessing submenus / extension manager

    14
    0 Votes
    14 Posts
    6k Views
    J
    ("a".."z").each { |l| begin print "Trying #{l};" UI.menu(l).add_submenu('jim') puts "OK" rescue puts "Error on #{l}." end } I don't like the "code" font, by the way; it's hard to read.
  • Organize your Rubies?

    7
    0 Votes
    7 Posts
    5k Views
    A
    I'm wondering, why the Ruby extension programmers do not make use of the Sketchup built-in Extension class, so the users can switch the extension on and off via Window > Preferences ... In every case (with a loader script or built-in support) you need to restart Sketchup when switchung off extensions, because you can't take away menu items. Would be possible to overwrite the methods in the Ruby extension when switching off via loader script, but anyway the extension is loaded. Also have a look on my approach(!) to organize scripts: http://www.sketchucation.com/forums/scf/viewtopic.php?f=127&p=7623#p7623 azuby
  • Something about AppObserver#onQuit

    2
    0 Votes
    2 Posts
    4k Views
    R
    Sorry I'm no help - have not tried that observer yet. The onSave observer has been requested, and noted by the SU folks, so maybe we'll get that one soon...
  • Shortcuts Plugin Possible?

    19
    0 Votes
    19 Posts
    9k Views
    CadFatherC
    the CadFather strikes again! EDIT: one more bug, if you go and enter a new (or the same) key for 'add scenes', 'update scenes' etc it will overwrite your tweak - however it will work as long as once you have set it you leave it alone. and that is the end for tonight
  • Make &quot;saveas SU5&quot; default in SU6...

    8
    0 Votes
    8 Posts
    6k Views
    CraigDC
    Ah yes, Tom, I am aware of the edges showing through alpha pings. I entered that bug in our database actually! Yeah, it's a tricky one, I hear... Man, it's always hard when one person's bug is another person's daily workflow. I empathize. I will add some weight to the bug. That is part of my "special purpose".. Cheers, - CraigD (Is there any other "CraigD"! :wink:
  • Align points

    5
    0 Votes
    5 Posts
    6k Views
    PixeroP
    Thanks Azuby, I didnt know that. But I am a noob on Ruby. I've never seen it in the ruby docs though. Since I've seen both @ and $ used, I assumed you could use either. In my noobiness I though the @ came from @-atlast. Rick W, thanks I tried it but it still doesnt work. Could you please take a look at my script to see where I go wrong? Maybe try my script with a rectangle and set Align to custom and some custom value. jsAlign.zip
  • Scripy sticks?

    4
    0 Votes
    4 Posts
    6k Views
    CadFatherC
    hey Coen that's way fast!! chill out! thanks Didier, i think i did it right - did try a registry trick but it didn't work... and this business has been around so long...
  • Ss add ss.group ???? Need Help

    2
    0 Votes
    2 Posts
    7k Views
    TIGT
    Try ss.add(ss[0].parent.entities)
  • May I know how to use &quot;close_active&quot; from the Model Class,pl

    2
    0 Votes
    2 Posts
    7k Views
    TIGT
    Sketchup.active_model.close_active will close a group or component that you have open for editing, and return to the base model, or group/component if the group being edited is 'nested' inside others. It returns 'true' if successful. It will return 'false' if you are in the base model itself as there's nothing to 'close'... TIG
  • Working with selection - ungrouped or within a group

    4
    0 Votes
    4 Posts
    8k Views
    Didier BurD
    Yes it is doable. For instance: def editing_group? if Sketchup.active_model.active_entities.parent.class == Sketchup::ComponentDefinition and Sketchup.active_model.active_entities.parent.group? return true else return false end Will return a boolean to tell the script if the user is currently editing a group. BUT using methods of the selection class is independant of that. Even if the user is editing a group, Sketchup.active_model.entities can be accessed the usual way, and Sketchup.active_model.active_entities will return a collection of entities of the active group/component. If you have to check wether selection is a group or not, use this test: Sketchup.active_model.active_entities.parent.class == Sketchup::ComponentDefinition (because group are stored as if they are components !) and if you have to check wether a particular selected object is part of a group or not, use this test: if editing_group? and Sketchup.active_model.active_entities.include?( object_id ) ... Hope this helps,

Advertisement