sketchucation logo sketchucation
    • Login
    1. Home
    2. DavidBoulder
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 38
    • Posts 343
    • Groups 1

    Posts

    Recent Best Controversial
    • Is there a "Save Selection" ruby script out there

      So lets say I have a script that does a search and then hides everything that doesn't meet the criteria. Then it selects these objects. This selection has objects nested down inside the model. I thought my method to save the selection was to just save a scene with "hidden Geometry" checked.

      I of course found out that scenes only save the "hidden" attribute for entities that are at the top level, so children entries keep their current "hidden" state regardless of what scene you go to. Well it isn't quite that clear cut. If I have a three objects visible in scene "A" and hidden in scene "B" and then while in scene A I group them. Those children turn to hidden when I go to scene "B" but they don't unhide again when I go back to scene "A". However if I now explode this group and click on scene "A" and "B" again, the scenes still remember which objects should be hidden and correctly display them, unless you had updated your scenes will they were grouped, then the data seems lost.

      Anyway, so my point is how else do I save multiple searches for future viewing. I thought maybe there was already a plug-in that does this. Seems easy enough to create a named selection and provide interface for the user to recall this selection. Obviously some objects may have been moved, deleted or added, so it isn't the same as re-running the search.

      posted in Developers' Forum
      DavidBoulderD
      DavidBoulder
    • RE: How do you find an axis for rotating something that's round?

      Sometimes I make a temporary cube to set the rotate axis I want so I don't have to change my view.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • RE: If statement issue with # divided by -0

      FYI - I just added a file to this. It is a sample version of Sang with three Dynamic Attributes.
      TestFormula = =if(usernumber=1,"you are 1",usernumber/(usernumber-1))
      anotherformula = =if(usernumber=1,"you are 1","you are not 1")
      usernumber = (user input)

      Each formula has the same formula except for the "false" case which is where the div0 is in the "Test Formula). Why does it care what is in that until it fails the "usernumber!=1" test.

      So the IF isn't being ignored unless I happen to have a value that makes a Div0. It is as if it checks for that before it bothers reading the formula. If there aren't any Div0's then it correctly uses the If statement like it should.


      Sang-div0 test.skp

      posted in Dynamic Components
      DavidBoulderD
      DavidBoulder
    • RE: Don't DC to rotate even if parent component does

      @unknownuser said:

      If their axis is not aligned to the parent's axis though, it is also going to require computing x,y,z values. Rotating the parent will change their rotation AND their location.

      Chris, I missed this as it was just about when I made my last post. I'm not too concerned about the location of the children moving. I am more concerned about keeping the child on the same rotX,rotY,rotZ rotation as the top level model axis; by this I mean rotX,Y,Z all = 0

      So I have two big issue with my setup right now.

      1. First is that this only works if my parent is a top level component/group. If someone places it inside of a group then I lose my bearings. If I know they need it inside a group I can setup a DC group that itself would pass information. So there would be a grandparent/parent/child setup. But I don't want to have to rely on this.

      2. My second problem is that my child can handle rotations on any axis, but it has trouble with more than one. So I'm ok if I change rotX, or rotY, but not rotX & rotY.

      I have attached a file with two instances of my component. One is top level one is inside of the group. So if you select all and rotate, only one will fix itself. And you have to use the interact tool or right click to REDRAW() for it to update.

      OK, I take that back. This is where things get odd. I base my calcualtsion off what I think the parents rotX,Y,Z are based on, and the odd things is a "REDRAW" by clicking on the interact while the parent is nested in a grandparent, doesn't give the same results as when I REDERAW when I have gone into the grandparent.


      rotation problem.skp

      posted in Dynamic Components
      DavidBoulderD
      DavidBoulder
    • Any way through ruby to create a component collection

      I have a component that needs a number of dynamic components. As it is now I just load those components when the script starts. But then it just gets cluttered in with all of these new definitions that get made as I change attributes. So I thought, maybe it is better that I just have this as a component collection. If necessary I can just make this collection as part of the install process for the plugin, but I was wondering if there is a way via the API to create this collection on the fly. I didn't see any API references for this, but I thought I would check.

      David

      posted in Developers' Forum
      DavidBoulderD
      DavidBoulder
    • RE: Why do some Components not scale?

      I never noticed that behavior either. I wonder if you make the component unique if it will scale. they you could right click on it "save as" to over write the original defenition.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • I want to globally scale a set of components

      So I'm working on a project that will have a bunch of Dynamic Components.

      Many of these don't have an actual size they need to be, they are kind of like 3d icons representing objects. I want to user to be able to change one value and globally change the size of these. Alternatively I could try something like using the camera FOV or distance to target. But that would require redraw a lot, which I don't think I want.

      At first I gave each DC its own variable "view scale". I suppose I could still do that and then have an observer recognize when one is changed, and push the value to all other components with this attribute field. Or I don't use DC for this at all, but have it as a pure ruby. Maybe this would be a good way to set attributes to global for other uses.

      This could be the type of attributes.

      • instance attribute
      • definition attribute (this get applied to all instance of a single definition)
      • regional attribute (this get applied to any dynamic component that passes a name query "e.g. Desk*" that also has this attribute key)
      • global attribute (this gets applied to any dynamic component with this attribute key)

      For all but the instance case, when you change the attribute value in one DC, it then gets pushed via an observer to all other dynamic components. This also kind of creates a method for non related DC's to talk with each other. This DC observer could be a catch all for intra-DC communication.

      So my first thought is how do we keep track of what type of attribute is of which kind. Does the DCManager.rb keep track of this, do I pre-fix them a certain way, or add an extra field to denote if it is anything other than "instance"

      For example here would be a global attribute
      viewscale = 1
      atcls_viewscale = global

      Having some sort of tag in the DC would make the ruby more generic, and it wouldn't have to be changed as you add new non-instance attributes. When the observer recognizes activity it would look for attributes named "atcls_* and from that it would have the name and class of the attribute to be pushed through the model. One issue would be when you bring something new into the model. Most likely it will have a different value. Rather than have this new value overwrite the global variable, maybe an alert is brought up saying this doesn't match. "Would you like to change this value to match the global value, or would you like to make this the new global value?"

      posted in Developers' Forum
      DavidBoulderD
      DavidBoulder
    • RE: If statement issue with # divided by -0

      @unknownuser said:

      if(n==1,do this,LenX/(n-1)) ?

      what is the double equals for? SketchUp doesn't seem to like "==" in that formula.

      posted in Dynamic Components
      DavidBoulderD
      DavidBoulder
    • Using SU version check to hide parts of a Dynamic Component

      OK, so I'm incorporating the use of some dynamic components into a plugin I'm working on. The Dynamic component is adding features, but they aren't critical so things will still run under SU6, however some visual information on the DC will be misleading since it doesn't update based on changes to the attributes. So If someone opens a file in file in SU6 with these specific components, I want SketchUp to hide specific elements. I can select and hide, or probably better, put these sub-components on a layer that identifies them to be off in SU6, then the ruby can turn that layer off.

      But then If someone opens with SU7 a similar test can be run to make sure that this layer is turned back on. The alternative is to have separate sets of components for SU6 vs SU7 users, but I think it is cleaner to avoid that. This will be more consistent when passed between SU6 and SU7 users. Hopefully SU6 users will be a small percentage, but I know they are still there.

      Has anyone written a script like this before. I know it can be done, but just looking for insights from others who may have already done something like this, on the best approach.

      posted in Developers' Forum
      DavidBoulderD
      DavidBoulder
    • RE: Re-use progress bar that Dynamic Components use

      Thanks Chris. I saw that, but for this project my client doesn't want to incorporate anything that we can't distribute directly with our software., which it looks like smustard's EULA doesn't allow for. Of course I can try to talk to Todd to get specific rights for it; I haven't done that.

      I was hoping there was a way to access what was already in SU, but I guess not.

      posted in Developers' Forum
      DavidBoulderD
      DavidBoulder
    • Re-use progress bar that Dynamic Components use

      When I have a Dynamic Component operation that takes a while a text progress bar shows up on the status bar.

      Does anyone know how to incorporate that into ruby scripts. I know there is one on smustard but I think it pre-dates SU7. I thought maybe this is in the API for SketchUp 7 when dynamic components came out.

      posted in Developers' Forum
      DavidBoulderD
      DavidBoulder
    • RE: Characteristics of a Good DC

      @unknownuser said:

      The model and all model geometry should live on the zero layer
      When component models are loaded into the larger building model, it is important not to upset the layer conventions being used by the designer. Many models available today break this rule, containing multiple layers for different aspects of the model, with lax naming conventions, etc. A correctly built component will live on 'Layer 0', preserving the overall models layer structure.
      The model should be made up of nested sub-components and groups.

      I think there are exceptions to this. Take for example a DC I'm working on. I'm using labels in it to identify some things. At times I want to user to have the ability to show or hide labels. To function correctly and stick to the elements they reference they can't be a component of their own. So to easily turn them on or off, the actual entities must be on a different layer e.g. "labels" instead of Layer 0. Now I'll probably make the layer more unique like "MyProductLine_labels" which will match naming convention I use for other layers that just hold components, vs root level drawing elements.

      posted in Dynamic Components
      DavidBoulderD
      DavidBoulder
    • RE: Panoramic or other output with "proper animation"

      That is true, you can't move the camera off it's path, but if you do a multi-row one, the viewer can look at it from any angle, or at least within a few degrees, depending upon how many cameras you set up. Then you could also set up the viewer so they can zoom in to see more detail in an area.

      But your camera is still stuck on a sphere looking in towards the center. Pretty much the exact opposite of a panorama where you camera is at the center of the sphere looking out in any direction.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • RE: Panoramic or other output with "proper animation"

      You can create an array of cameras that rotate around a point where your object is. Then export to jpgs, and you can use 3rd party software to turn into an object movie that users can navigate. You could create a single row object where it just spins, or an multi row one that lets the users tilt up or down.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • RE: Panoramic or other output with "proper animation"

      You can create an array of cameras that rotate around a point where your object is. Then export to jpgs, and you can use 3rd party software to turn into an object movie that users can navigate. You could create a single row object where it just spins, or an multi row one that lets the users tilt up or down.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • RE: Problems importing an Elipse from AutoCad

      Another option for importing from Autocad is to pass it through Adobe Illustrator first. There you can convert curves to segments and have more control over the segments.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • RE: Help with export. Google really needs to fix this

      I haven't read all of the posts, so maybe someone has suggested this. Have you tried (on a copy of the file) make texture unique, and then purge the model. This will make things a lot smaller. However, I think this would have to be one texture at a time, but I suppose you could write a script for that.

      posted in SketchUp Discussions
      DavidBoulderD
      DavidBoulder
    • RE: Multiple Set() attributes for onClick behavior

      Thanks, just what I was looking for. I had tried with a space but not a semicolon.

      Much easier than the hoops I was jumping through.

      posted in Dynamic Components
      DavidBoulderD
      DavidBoulder
    • Multiple Set() attributes for onClick behavior

      I don't think this can be done, but thought I would ask if I could attach multiple behaviors to an onClick behavior. In my case when the user clicks I want to add an extra row and column. Or a row on one click, and then a column on the next click.

      I think I could get this to work if I created a statement looking for odd vs. even, and then took different action based on that. But I also still want to user to be able to manually set the rows and columns. If I use a formula for the number of rows and columns, do I give up the ability for the user to manually override and choose their own value?

      OK, it looks like they can manually override. but then the formula is lost. I guess not too bad. They can have the click interactivity at first, but once they manually change, then it wont' work on this instance, unless they re-load (which would loose other data)

      posted in Dynamic Components sketchup
      DavidBoulderD
      DavidBoulder
    • If statement issue with # divided by -0

      I have a stretchable surface that I'm dividing in the x and y direction through two user inputs.

      If the user enters "5" then I draw file dividing lines (including the two edges) so I end up with four gaps. So to get the correct measurement I take LenX/(n-1). This works great unless the user's original number was 1. The desired result if the user enters "1" is to just have a line at one edge.

      Of course if I leave things as they are I get an error because I'm dividing by 0. So I created an If statment something like this

      if(n=1,do this,LenX/(n-1)). So what is odd, is that when I have a value of 1 and should just "do this" I still get an error about the Div/0. I'm not sure why. Has anyone else run across this.

      posted in Dynamic Components sketchup
      DavidBoulderD
      DavidBoulder
    • 1
    • 2
    • 9
    • 10
    • 11
    • 12
    • 13
    • 17
    • 18
    • 11 / 18