🚨 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
  • Mathematical Formulas to Ruby

    9
    0 Szavazatok
    9 Hozzászólások
    717 Megtekintések
    thomthomT
    Thanks Fredo. I've taken an interests into Bèzier patches. And while I could easily produce a patch using the @Last bezier.rb, I wanted to try to understand more about how it worked technically. That way I could eventually improve the method I use to create the patch, as at the moment I'm not sure if it's efficient the way I do it. But yea, Bèzier curves are really cool. Thanks for your feedback Fredo.
  • Autosnap?

    22
    0 Szavazatok
    22 Hozzászólások
    3k Megtekintések
    finewoodF
    Sorry, was a response to this post ...... Jim Global Moderator Posts: 2091 Joined: Mon Nov 12, 2007 10:13 pm Name: Jim Foltz Operating system: XP Pro SP3 SketchUp version: Google Pro 7.1 .....but the thoughts are free - also my finewood
  • Slice solid objects

    4
    0 Szavazatok
    4 Hozzászólások
    395 Megtekintések
    pilouP
    Better indeed
  • Boolean subtraction of two circle

    13
    0 Szavazatok
    13 Hozzászólások
    875 Megtekintések
    TIGT
    @thomthom said: @tig said: Thomthom Grumpy... I came across grumpy? The English phrase is you were 'terse' [avvisende]... or 'a little short' [litt kort]... just like your old school teacher might be when you ask a seemingly stupid question or you are doing something that is obviously not right [to him] AND he has a hangover etc etc
  • Adding instances to a new group bug?

    2
    0 Szavazatok
    2 Hozzászólások
    229 Megtekintések
    TIGT
    ... tr=Geom::Transformation.new(group.transformation.origin) instance=group.entities.add_instance(definition,tr) or work out where the insertion_point is relative to the group's origin something like... insertion_point=[x,y,z] insertion_point.transform!(group.transformation.inverse)###??? tr=Geom::Transformation.new(group.insertion_point) instance=group.entities.add_instance(definition,tr) A group's origin is at ORIGIN [0,0,0] even when it's miles away so you need to move any insert backwards ? This is untried but my first thoughts...
  • Select percentage+random inside group/component?

    2
    0 Szavazatok
    2 Hozzászólások
    232 Megtekintések
    thomthomT
    http://forums.sketchucation.com/viewtopic.php?p=44671#p44671
  • Flags on onKeyDown?

    21
    0 Szavazatok
    21 Hozzászólások
    2k Megtekintések
    J
    @chris fullmer said: I don't quite understand what that means. What is bitwise? Think in binary, then compare them column for column. It's a logical, bit-to-bit comparison. 5 in binary is 101 6 in binary is 110 5 & 6 is; logical AND each column (bit position) Columns ________________ | 1 | 0 | 1 <- decimal 5 | and | and | and | 1 | 1 | 0 <- decimal 6 ================= 1 0 0 so 101 & 110 = 100 <- decimal 4 The masks are constants, which are set to some convenient values: # I just made these up 001 = CONSTRAIN_MASK 010 = ALT_MASK 100 = COPY_MASK So if the flag is decimal value 7: 111 <- decimal 7 In order to check the CONSTRAIN_MASK, you logical AND the CONSTRAIN_MASK with the flag value: 111 <- flag value decimal 7 & 001 <- contain mask constant ====== 001 <- CONSTRAIN_MASK set true or in real ruby as Thomas wrote; contrain_key_down = ((flags & CONSTRAIN_MODIFIER_MASK) == CONSTRAIN_MODIFIER_MASK) copy_key_down = ((flags & COPY_MODIFIER_MASK) == COPY_MODIFIER_MASK) alt_key_down = ((flags & ALT_MODIFIER_MASK) == ALT_MODIFIER_MASK) Although Adam B might know a clever way to decode them all in one elegant statement.
  • Flip along Z

    15
    0 Szavazatok
    15 Hozzászólások
    1k Megtekintések
    Chris FullmerC
    well in the end, I've had to mix and match some thoughts from this thread. I realized that I can ont doa simple rotation or scaling because in my case, I have to scale using the components local axis. If their axis is set on one of the sides of the component, I want it to rotate or scae around that axis, not the boundingbox centerpoint. So I just threw in a way to determine the the center of the component on the local z axis. Had to account for component z-scaling AND if the axis was set somewhere inside the component (not at the very bottom for example). All in all, I've got it working like a charm now (I think!). It will be in the next component stringer. Chris
  • Matrices can be your friend - webpage

    7
    0 Szavazatok
    7 Hozzászólások
    609 Megtekintések
    M
    Attached is the Baker article in black text on a white page. I've read it and it makes almost complete sense. What was the "glRotate" he referred to? Is that openGL? Does that help us? I've read Wiki (gone thru the words one at a time, anyway) and it is dense. Went to Wiki's Transformation Matrix article and it was unreadable. I left a message to that effect on the talk page. If you go there, please move my message to the bottom of the talk page (where I should have put it) and add another message re "how about writing for folks who didn't get a PhD in math?" change the extension back to html (board doesn't allow ULing HTML).
  • FollowMe and scale?

    5
    0 Szavazatok
    5 Hozzászólások
    282 Megtekintések
    thomthomT
    @tig said: My recent update ExtrudeEdgesByRailsalso scales the Edges-Profile between the rails, rotating and scaling the profile to suit the gap between the [apprortioned] nodes of the rails... Cool. Will have a look at it.
  • Materials Bugs?

    16
    0 Szavazatok
    16 Hozzászólások
    1k Megtekintések
    C
    ThomThom, you rock! That took care of the issue on this model. Thank you so much and have a Happy Thanksgiving! C
  • How to set egds of an enities in-visible?

    7
    0 Szavazatok
    7 Hozzászólások
    349 Megtekintések
    Chris FullmerC
    I like that one Jim.
  • Hide semantics

    20
    0 Szavazatok
    20 Hozzászólások
    999 Megtekintések
    TIGT
    Having slept on this... An Entity that is part of a Definition's Entities is a single 'thing'. Instances of this Definition can be 'placed' within the Entities of a Model or even those of other Definition. Instances are themselves 'Entities'... These Instances are simply 'markers' and refer to the Definition - they have no 'contents' of their own. Any properties that this Entity has [like visibility, material, layer etc] are set within the Definition's Entities and cannot be changed on an Instance by Instance basis as they don't exist. Any Instance of the Definition containing this Entity can have individual properties [like visibility, material, layer etc] - some of these might even get reflected down the nesting - like 'material' which when changed on the Instance will affect the appearance of any contained Entities which have their material=nil, however the 'visible' property does not filter down. Visible/hidden Entities within a Definition [that is seen as an Instance] remain visible/hidden independent of each Instance's 'visible' state - however, if the container Instance is 'hidden' then you cannot see it, and by logic you cannot see its contents - irrespective of whether or not they are visible/hidden within the Definition itself. This is a logical setup. Let's say you have Entity called A [an Entity is unique, but of course it might itself be just one Instance of a Definition]. 'A' is within a Definition and there are 6 Instances of this Definition within an Entities set. 2 of these Instances are visible the other 4 are not. Thus you can only 'see' 2 representations of A. However, there are 6 representations of A 'available' in the scheme of things - so, how do you get the number of visible A's ? Remember you can't refer to a particular A in a particular Instance because there is only one A and that's inside the Definition. If you mined down into the contents of every Definition in the Model to find A you will eventually get just one parent Definition returned because every Entity is unique - however, if A were an Instance then finding its Definition and then that Definition's Instances would give us a list of all Instances equivalent to A - however, they are NOT A itself, but a list of Instances of A's Definition - we can't confuse Entity-A and Definition-of-Instance-A - this would just make it more complicated to find them all, but it's not impossible. For now let's assume we have a simple Entity A, and we have its parent Definition, we can now find a list of all of that Definition's Instances, and then from this list we can get lists of all of those Instances that are visible/hidden. Thus we can say that Entity A exists 6 times in the Entities set, that it is visible 2 time and that it is hidden 4 time, simply by looking at the lists we just made of the parent Definition's Instances visibility. Since we know which are the Instances displaying A we can find each of their locations and thus the location of the 'ghost' of A within them, since we know where A is inside the Instance's Definition... However, if Entity A were hidden in its Definition then it would be always hidden in every Instance we looked at, so in that case, irrespective of the containing Definition's Instance visibility, A is 'hidden' in all 6 cases even when its container is visible... Not sure much of this is of any practical use...
  • Collaborative Effort - Ruby Template, RDoc, and Localization

    36
    0 Szavazatok
    36 Hozzászólások
    11k Megtekintések
    Dan RathbunD
    @jim said: What about creating an abstract base class named Plugin which provides inspectors for the information? Not only could inspectors be created for name, author, copyright, license, etc; but also inspectors for menus, Commands and toolbar images? This way, external applications (menu organizers, etc) can simply ask the plugin about itself. I've actually done some playing around & testing this past week along these lines, before I saw this post. I had seen, in many standard (extra Sketchup) ruby scripts, that coders were just declaring a string constant "VERSION" at the top of their outer code blocks. This could be easily accessed ie:, Module::VERSION. But then the spark for me was seeing somewhere (perhaps within the RubyGems files,) someone took it a baby step forward by making the constant VERSION a Hash with 4 elements, the first 3 Integer components of the version number, and the 4th a string concatonation of the first 3. ie: VERSION=[MAJOR => 0, MINOR => 0, TEENY => 0, STRING => (MAJOR,MINOR,TEENY).join(".") ] This was a bit better, as you could get any one of the version components for comparison, without having to convert to numeric, by calling as an example: if Module;;VERSION[MAJOR] < 7 {..do a block..} Or if you wanted the whole version string, you'd call, like so: messagebox( "The plugin version is; #{Module;;VERSION[STRING]}" ) But the spark had not yet ignited into flame until I stumbled across the standard ruby class OpenStruct. When I read the filenotes in 'ostruct.rb', I immediately thought this is perfect for versioning !! OpenStruct is similar to the built-in class Struct, but really makes it act like a true data object should act in an object oriented language like Ruby. Struct on the other hand is so much like a hash, there doesn't seem to be much benefit in it; as you still set and access values as you would in a hash object. OpenStruct is SO MUCH better! You simply state a new object name = followed by OpenStruct.new(keylist), where the keylist is just that; a list of data keys to create. The class creates all the keys as attributes, and automatically sets up getter and setter accessors for each one! (Pssst! [whispering off topic this would also be great for ruby-side JSON as OpenStructs will look and act just like Javascript Objects..)] So my thoughts are to set up a custom subclass of OpenStruct called VersionStruct, or just a custom class called VersionStruct that uses an OpenStruct. Still playing and testing which way is better. Any way the goal is to have something that is all setup correctly that can be either 'included' or mixed-in into a top code block, so the module or class inherits the data structure; OR instanstiated into a code block if it's set up as a class. (I cannot see making coders cut and paste a codeblock into everyscript, errors may creep in.) Anyway.. after instantiating a VersionStruct, a coder would set the fields, then freeze the VERSION object (so the data cannot be changed after the script is loaded.) Example: ['RubyTools' is a fictional Namespace.] module DandyCode VERSION = RubyTools;;VersionStruct.new(2,1,4) # first 3 parameters are integers; major, minor, teeny # note VERSION.string is created automatically VERSION.author="Ruby A. Coder" VERSION.copyright="(c) 2010 by author" VERSION.disclaimer="No Waranty...no particular purpose...author to be held harmless ...etc" # can be preset VERSION.termsOfUse="Free for Public Use...etc." # can be preset VERSION.title="Title of this plugin code" VERSION.description="A short explanation of it's features." VERSION.minSUverMajor=7 VERSION.minSUverMinor=1 VERSION.dependancies=self.DependancyList VERSION.exclusions=self.ExclusionList VERSION.freeze DependancyList = Array.new DependancyList[0] = DependancyItemStruct.new(module='JRF;;Inputbox', minverMajor=2) ExclusionList = Array.new ExclusionList[0] = ExclusionItemStruct.new(module='SluggishKeyTrapper', allVers=true) VERSION.freeze .. more code ... end # module Anyway.. ideas to chew on... Currently.. I'm only playing with a VERSION structure that has Major, Minor, Teeny and String attributes. The other attributes in the above example, or discussed in the prior posts, could be in a separate struct as Jim suggested called 'Plugin' or whatever. (We've seen a similar thing done with the Sketchup Extension Class, except that it's put in a separate file.) For those interested, who don't have a full ruby install, I attach the ostruct.rb file that ships with Ruby 1.9.1 (put it in a folder that's in the search path, perhaps the Tools folder. I personally have it in a folder named 'Library' which I put in my search path.) ostruct.rb
  • Ruby Cost.rb Script File

    3
    0 Szavazatok
    3 Hozzászólások
    568 Megtekintések
    M
    Jim, Thanks for the information. It worked. MPKArch
  • How to get face uvs if texture is applied to component inst

    18
    0 Szavazatok
    18 Hozzászólások
    1k Megtekintések
    W
    Thanks Thomas!
  • [Code] Ruby Extension for Sketchup color integers

    7
    0 Szavazatok
    7 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    Added to the original post (root of thread,): Clarification: As discussed in the thread below... these methods really belong within the class to which they provide benefit and functionality. This class or classes, would be any Color object class that is defined in ruby, for whatever purpose. The example code can be rewritten slightly, so as to make it a generic mix-in module, for including in any Color class definition. In this way any Color class could inherit the conversion methods in the mixin module. Such a module would have as it's first line "module ColorIntegerConversion" instead of "class ::Integer", and this will be the way that it would be submitted for Standard Ruby, NOT as an extension to the ruby base Integer class.
  • How to tell when a material is not really a material (Image)

    5
    0 Szavazatok
    5 Hozzászólások
    300 Megtekintések
    thomthomT
    This is something that the manual should mention. I'll add it to the list.
  • Evaluate a dynamic attribute in Ruby?

    2
    0 Szavazatok
    2 Hozzászólások
    267 Megtekintések
    Chris FullmerC
    Yes. Dynamic components store their dynamic attributes in attribute dictionaries on the compopnent (or the definition mayeb). So dig through the attribute dicts to find one from the dynamic comp, and it will have all the values in there. Chris
  • Ending a tool

    9
    0 Szavazatok
    9 Hozzászólások
    791 Megtekintések
    thomthomT
    @adamb said: I've always used Sketchup.active_model.tools.pop_tool so it returns to whatever you had before rather than forcing the use of SelectionTool. Adam Do yo have to use Sketchup.active_model.tools.push_tool to activate the tool then? Because I tried Sketchup.active_model.tools.pop_tool when I had activated the tool using Sketchup.active_model.tools.select_tool - and that did not seem to do anything.

Advertisement