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

    Posts

    Recent Best Controversial
    • RE: MSPhysics

      @Rich-O-Brien I put this offer to help on the old thread. I'm not sure if it will be seen, so I'm adding it here too:

      I would like to offer to help with work getting MSPhysics updated. I wrote the infamous plugin sph4bar in 2006 which models spherical 4 bar mechanisms. I also wrote GeoSketch, a plugin used by aerospace companies.

      In a previous life, I worked for Cadsi, where I integrated DADS (Dynamic Analysis and Design System) into CAD systems such as CATIA and Ideas Master Series.

      Now I am retired and have time to kill.

      posted in Plugins
      S
      spring.freediver
    • RE: MSPhysics 1.0.3 (16 October 2017)

      Is there any news on MSPhysics being updated for newer versions of SketchUp?

      I would like to offer to help with work getting it updated. I wrote the infamous plugin sph4bar in 2006 which models spherical 4 bar mechanisms. I also wrote GeoSketch, a plugin used by aerospace companies.

      In a previous life, I worked for Cadsi, and integrated DADS (Dynamic Analysis and Design System) in to CAD systems such as CATIA and Ideas Master Series.

      Now I am retired and have time to kill.

      posted in Plugins
      S
      spring.freediver
    • MSPhysics

      Re: MSPhysics 1.0.3 (16 October 2017)

      Is there any news on MSPhysics working in newer versions of SketchUp? (E.g. 2024?)

      posted in Plugins
      S
      spring.freediver
    • RE: Ruby errors in Sketchup 2021

      Thank you TIG. I was not able to find that it was deprecated.

      I can just use 'size' instead.

      'nitems' was not about limiting the array to integers. It was simply to provide a count of non-nil items in the array.

      By the way, I was using http://ruby-doc.com/docs/ProgrammingRuby/ for Ruby documentation, and it still lists nitems as a method of the Array class.

      Can you recommend a better site for documentation of the version of Ruby Sketchup is now using?

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Ruby errors in Sketchup 2021

      The plugin is GeoSketch (https://www.youtube.com/user/TacForgeGeoSketch/videos)

      I wrote GeoSketch in the 2008-2012 timeframe. I hadn't used Sketchup since then, but had a need for GeoSketch recently. I purchased a license of SketchUp 2021 last week, so I could try to get GeoSketch running again. Most of it works, but I get this error in one method.

      I can probably replace 'nitems' with 'size', but it won't address nils in the array. But I shouldn't have any.

      I do find it curious that 'nitems' seems to be missing. As I replied to TIG, I did a Google search to see if it was deprecated, but didn't find anything.

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Ruby errors in Sketchup 2021

      It can be reproduced with one line, similar to the example in the Ruby Documentation:

      [1, 2, 3].nitems

      This should return "3". Instead it returns:

      Error: #<NoMethodError: undefined method `nitems' for [1, 2, 3]:Array>

      In the script, I am using it in an if statement to do different things, depending on how many items are in the array. Pretty straight forward.

      I did a Google search to see if 'nitems' had been deprecated in this new version of Ruby, but didn't find anything.

      posted in Developers' Forum
      S
      spring.freediver
    • Ruby errors in Sketchup 2021

      I have an old Sketchup script (written in 2012) that I am trying to get working in SU 2021, which I know has a new version of Ruby:

       Error: #<NoMethodError: undefined method 'nitems' for []:Array>
      

      This error does not make sense to me, since the Array class does have a method called 'nitems'. I checked to make sure the array is not nil (which would have produced a different error).

      Does anyone know what might be causing this error?

      posted in Developers' Forum
      S
      spring.freediver
    • Make Unique Texture

      Is there an API equivalent to the interactive context menu item for a face called "Make Unique Texture"?

      Also, is there a known problem with Texture Writer reducing the resolution of Textures? When we write out an OpenFlight file, we try to use the original images to create the OpenFlight rgb files. But if the original images are not available, we resort to using the Texture Writer. Our customers complain the there is a loss of resolution when we use the Texture Writer. Is there any way to control the resolution?

      posted in Developers' Forum
      S
      spring.freediver
    • Observers work differently depending on how Sketchup starts?

      Has anyone else seen this:

      We have a plugin which uses observers. It also stores attributes in the model.

      If we start Sketchup by selecting the desktop icon, and then open a model with our attributes in it, everything works fine.

      However, if we start Sketchup by double-clicking on the model name in explorer, the model opens, and our tools are present, but they do not work correctly. Our attributes are present in the model, but observer callbacks which use the attributes do not work.

      We have Sketchup::AppObservers set up for both onNewModel and onOpenModel events, but in the second case described above, they don't seem to be triggered.

      Thanks for any help.

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Untagged deleted element after using outer_shell on group

      Thanks for all the feedback guys.

      TIG: the xxx and yyy are not the actual values. Since they aren't relevent, I replaced the longer names used in the actual code. As for what the application is doing, it is simply allowing the user to intersect a ray with one of the faces of a newly created outer_shell group, and then finding all the connected elements of that face or edge. I used raytest so I can get all the transformations for a nested entity from the item[1] array. As I mentioned, this is old code I have been using for over a year. It just started displaying this problem when I used it on the result of outer_shell. The code that I showed was some hastily added debuging code. I suspected that valid? and deleted? were redundant, but was just trying to find out what was happening.

      Dan: Based on your suggestion, I read the docs on GC.start. When should I use it? Immediately after doing the group.outer_shell? I was not aware that entity lists could be changing in the background while a Ruby script was running. I assumed that when I called outer_shell, Sketchup would not return control to my script until it had done all of it's cleanup of entity lists. GC.start would not affect what they have going on the C side, would it?

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Untagged deleted element after using outer_shell on group

      Sorry. I didn't show line 280, which generates the error:

      e1 = entity.all_connected.find {|e| e.valid? && !e.deleted? && e.get_attribute("<xxx>", "Type", false) =~ /yyy/}

      This line assumes that Ruby, like C, will stop evaluating && expressions as soon as one is false. But in this case, the first two are not false, which I verified with the printf statements I showed above.

      The printf's are just for debugging purposes. This is code I have been using for a long time. But it suddenly doesn't work when I use it on a group created with outer_shell. In only that case do I get the situation where valid? and deleted? tell me the entity is OK. But when I check for an attribute on the entity, it suddenly says the entity is deleted. And it is only when I use outer_shell from a Ruby app. If I use the Solid Tool Outer Shell interactively, I do not get the problem.

      (I replaced some application specific info with xxx and yyy. Actual values were different, but not relavent.)

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Untagged deleted element after using outer_shell on group

      The example code shows that I am checking to see if any of the elements are deleted. The problem is that the valid? and deleted? methods are both telling me that the entity is OK, but then when I try to actually use the entity, it suddenly says that it is deleted.

      posted in Developers' Forum
      S
      spring.freediver
    • Untagged deleted element after using outer_shell on group

      I have run across an odd problem and wanted to see if anyone has seen something similar.

      I use the group.outer_shell on two manifold groups. I then use model.raytest on a resulting face, and use the following code to verify none of the returned items are invalid:

      item[1].each_index {|i| printf("ITEM %d:%s; valid?(%s); deleted?(%s)\n", i, item[1][i].inspect, item[1][i].valid?, item[1][i].deleted?)}

      And they are all valid. I then use entity.all_connected on the entity returned by raytest, and again check that all entities are valid:

      cnn = entity.all_connected
      cnn.each_index {|i| printf("CONNECTED %d of %d:%s; valid?(%s); deleted?(%s)\n", i, cnn.length, cnn[i].inspect, cnn[i].valid?, cnn[i].deleted?)}

      All connected entities are reported as valid and not deleted. But then I get this on the floowing line which scans the all_connect list:

      CONNECTED 140 of 143:#Sketchup::Edge:0x863fc60; valid?(true); deleted?(false)
      CONNECTED 141 of 143:#Sketchup::Edge:0x863fc4c; valid?(true); deleted?(false)
      CONNECTED 142 of 143:#Sketchup::Edge:0x863fc38; valid?(true); deleted?(false)
      Error: #<TypeError: reference to deleted Edge>
      C:/Program Files/Google/Google SketchUp 8/Plugins/<xxx>.rb:280:in `all_connected'

      This only happens after I use group.outer_shell. And after doing that, I use model.commit_operation

      Any thoughts? Is the something I need to do to purge deleted entities?

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Who changed extensions.rb?

      TIG,

      Yes , I had actually intended for GeoSketchFreeLoader not to be scrambled. That is the reason it is so small. When the installer was made, it inadvertantly got scrambled. But it should have worked anyway, and does with the Google version of extensions.rb.

      Regarding InstantRoof, I was only reporting the symptom reported to me. I don't know why InstantRoof would crash when the modified extensions.rb was removed, unless something else was changed accidently.

      Jeff

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Who changed extensions.rb?

      Yes, it appears to be an old version of extensions.rb, the copyright is 2005, and still refers to "@Last Software".

      As part of diagnosing the problem, I asked him to rename the extensions.rb in the Plugins directory. When he did this, our plugin loaded correctly, but he said that a plugin called "Instant Roof" crashed with a BugSplat. I have not installed "Instant Roof", so I don't know if it installs the modified extensions.rb

      As a workaround, I provided a new copy of our plugin loader which is not scrambled. This should make it work with the modified extensions.rb

      posted in Developers' Forum
      S
      spring.freediver
    • Who changed extensions.rb?

      We were investigating a problem where our GeoSketchFree plugin failed to load, and found the reason to be that a modified copy of extensions.rb was in the user's Plugins directory, apparently installed as part of another plugin.

      When Sketchup is installed, extensions.rb in placed in the Tools folder rather than the Plugins folder (presumably to protect it from being changed). By placing a modified copy in the Plugins directory, the Sketchup version is bypassed, and extensions do not work as designed by Google. In this case, the difference was that the modified version used the Ruby require command rather than Sketchup::require to load the extension.

      Is there any concensus among plugin developers concerning making such a change to extensions.rb?

      Our opinion is that this is not a good practice. By overriding the Sketchup version of extensions.rb, extensions do not work as designed and documented by Google. This can have an adverse effect on other plugin developers.

      Rather than changing the standard Sketchup definition of load for a SketchupExtension, it would be better to add a new unique method (e.g. "MyApp_load") to the SketchupExtension class, and use that to load an extension that cannot use the Sketchup::require for some reason.

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Edge color by material

      I found it to be:

      model.rendering_options["EdgeColorMode"]= 0 for Color By material
      model.rendering_options["EdgeColorMode"]= 1 for Color All same
      model.rendering_options["EdgeColorMode"]= 2 for Color By axis

      posted in Developers' Forum
      S
      spring.freediver
    • RE: Edge color by material

      Thanks TIG.

      posted in Developers' Forum
      S
      spring.freediver
    • Edge color by material

      Does anyone know a way to use Ruby to set the style such that edge color is "By material"?

      The documentation for Style and Styles is pretty thin. I tried using:

      Sketchup.active_model.styles.each {|s| puts s.description}

      But I saw nothing in the style description to indicate color was "By material".

      posted in Developers' Forum
      S
      spring.freediver
    • RE: OnUserText

      Oh yes, that was the thing I saw somewhere. 😳 Thanks TIG.

      It is odd that my other tools worked without it.

      posted in Developers' Forum
      S
      spring.freediver
    • 1
    • 2
    • 1 / 2