For the record, ongoing conversation at: http://forums.sketchup.com/t/how-should-i-use-s-and-t-scale-factor-from-sutexture/4589/6
Posts made by tt_su
-
RE: Material observer behaviour on OS X
@eneroth3 said:
<offtopic>
There's a Materials.current method ?? For my latest project I created a materials observer listening to active material change just so it could be assigned to a variable so I later could know what material is active. How could I have missed this? cleaning up some code
</offtopic>Beware that the material might not be in the model yet - in older version of SketchUp it can cause crashes if you try to apply the material to entities.
-
RE: [Plugin] Raytracer
@duanekemp said:
Is there a possibility that Drop Components by Bounds may not be working in SU2015?
It's working. If you have problems, please post a sample model.
-
RE: Unzipping archive from Ruby (Mac and Windows)
@eneroth3 said:
What do you think is the best implementation? What about showing a web dialog or UI.messagebox when the plugin loads and the gem isn't installed telling the user that the gem is required? The user can choose to do it later (next time plugin is loaded) and the extension wont load or choose to download it now and there's a message saying it may take some time. The user would also be informed that this only has to be done once (per user and computer). Of course the extension warehouse info page would say that the extension will ask the user to install the gem and then automatically do it.
There is no need for user interaction. You simply call Gem.install("nameOfGem") and it's done automatically for you. Look at the Gem module in the StdLib: http://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem.html
However, you might want to call that only right before you need to use the gem - otherwise, if you call that in the head of the RB file with all the other require's it'll lock up SketchUp until the gem has been downloaded and installed. Not a big deal perhaps in the normal cases - but imagine if a user copied a few extensions that did this, then there's be a potential large lag during startup. But only once.
-
RE: Unzipping archive from Ruby (Mac and Windows)
@fredo6 said:
Yes, I noticed there is a Zip module that seems to ship in Ruby 2.0 in the standard Sketchup installation.
I did not find the documentation however, but this could be the answer, at least for SU2014 and SU2015.
Fredo
It doesn't support ZIP files, it for general compression and GZ files.
-
RE: Unzipping archive from Ruby (Mac and Windows)
@eneroth3 said:
Thanks! The gem rubyzip gem does exactly what I wanted .
However I don't know what's the best practice to use a gem. Should I ask the user to install it or should I check if it exists when the plugin loads and otherwise install it? Should I in that case use statusbar texts to tell the user the gem is being installed and that it may take some time?
What I've done is wrap the require in a begin/rescue that catch LoadErrors (you don't want to catch other errors) and then use Gem.install to install it if it's missing.
-
RE: Unzipping archive from Ruby (Mac and Windows)
@eneroth3 said:
What sort of license applies to unzip.exe? I cannot find it anywhere and I'd like to use it for my next plugin.
Unless you need support for SketchUp older than SU2014 I'd go with the zip gem that john mentions.
-
RE: Load classification system via ruby code
Yup!
http://www.sketchup.com/intl/en/developer/docs/releases
http://www.sketchup.com/intl/en/developer/docs/ourdoc/classifications
http://www.sketchup.com/intl/en/developer/docs/ourdoc/classificationschemahttp://www.sketchup.com/intl/en/developer/docs/ourdoc/componentdefinition#add_classification
http://www.sketchup.com/intl/en/developer/docs/ourdoc/componentdefinition#remove_classificationhttp://www.sketchup.com/intl/en/developer/docs/ourdoc/componentdefinition#get_classification_value
http://www.sketchup.com/intl/en/developer/docs/ourdoc/componentdefinition#set_classification_value -
RE: Material observer behaviour on OS X
@pistepilvi said:
However, when running a Ruby script that changes the active material for Sketchup.active_model, observers from all models react to the event
Oh? That's certainly not intended. Though I'm not really surprised given the current state of observers.
I'll have a look at this.
-
RE: Extension rbz maker
@tntdavid said:
Yes ! So how can I do otherwise ?
In the root RB file, define a constant to FILE and use that constant in your RBS files.
Here is an example:
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword">require </span><span class="syntaxstring">"sketchup.rb"<br /></span><span class="syntaxkeyword">require </span><span class="syntaxstring">"extensions.rb"<br /><br /></span><span class="syntaxdefault">module Example<br /><br /> PATH_ROOT </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dirname</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">freeze<br /> PATH </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">PATH_ROOT</span><span class="syntaxkeyword">, </span><span class="syntaxstring">"sub-folder-name"</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">freeze<br /><br /> unless file_loaded</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">loader </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">PATH</span><span class="syntaxkeyword">, </span><span class="syntaxstring">"core.rb"</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">ex </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">SketchupExtension</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"My Super Extension"</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">loader</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">register_extension</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ex</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">true</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">end<br /><br />end </span><span class="syntaxcomment"># Example<br /><br /></span><span class="syntaxdefault">file_loaded</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault"></span>
-
RE: Ruby api: reference point within a component
@torel said:
(I could retrieve the position of the house instance via ComponentInstance::transformation, but I will also need the transformation of the door, for which I first needed to find the door instance among the entities of the house which is quite cumbersome - is there a nicer way?)
That's how you do it - you need to combine all them transformations.
-
RE: Material, Layer, Color, Alpha
@dan rathbun said:
Not so fast.
material.color
does not return a property. It returns a reference to a separate Ruby object, which can be shared across multipleSketchup::Drawingelement
subclass instances.Under the hood Material would convert that to an C++ color structure. The accessor recreate a new Ruby object when it returns it.
-
RE: [Plugin] Solid Inspector
@box said:
Sorry to say, and this might hurt me more than you because it's my all time favourite plugin, just disabling Bezier Surface makes it come back in both versions, for me.
Edit:
Opened a blank model and Inspector was there and usable.
Enabled Bezier Surface with the plugin manager. Created patch, made shape, exploded and added faces to make a solid. Checked with solid Inspector and found the deliberate error.
Saved file and closed.
Opened file with Bezier surface still enabled from last usage.
No Solid inspector in tools.So enabling BZ for a session rather than always on seems to be the way to go for now.
I just tried this - making sure Solid Tools and Bezier Surface is installed. And I wasn't able to reproduce.
Bezier Surface was located in its Draw menu and Solid Tools in its Tools menu.When I get back from this vacation, maybe we can set up a remote desktop session? If you let me poke about?
-
RE: SketchUp 2015 is 64bit
@driven said:
@tt_su said:
in London visting some friends.
if need someone to buy a pint for, I'm about...
johnYou live in London? Where abouts?
-
RE: Detect Linux from the RUBY or Sketchup API
I would place my bets with Andreas - as he use Linux and probably have figured this out. Looking for a Wine related environment variable makes sense since Wine would make SketchUp think it's running Windows - RUBY_PLATFORM wouldn't say linux.
-
RE: [Plugin][WIP][OpenSource] Bezier Surface
@pbacot said:
I could do that in say, 20 min. I can just send it to Box and open the file when it comes back done
Got a patch view of that?
-
RE: [Plugin][$] JointPushPull Interactive - v4.8a - 30 Mar 24
@fredo6 said:
The error on <model>.entityID is very strange because in Sketchup this is valid (it returns "Model".
Do you get this error for a sepcific model or always?
Fredo
Actually, this is Dynamic Component that adds that to the Model class. It adds a few methods to make the Model class blend with the regular Entity class.
The changes DC do to the SketchUp API classes makes sense - but unfortunately they where added as part of DC and not the API. So if DC is disabled they won't work.
I personally want them merged into the official API - though there are challenges as some of them are not ideal for the API, as they have some failing edge cases that was good enough for DC, but not for an API. Need to be careful to reduce breaking things. Hence it's not been done yet. -
RE: SketchUp 2015 is 64bit
@driven said:
@tt
so the advice for us to pass on to those who crash on first start-up, should be to...
submit the bug-splat for the download link?
or
simply re-download?
johnJust instruct them to download M1. We identified the bug so we're not in need of the crash data for that bug for M0 any more.
The BugSplat message is a convenience for those that do submit a splat - saves them from contacting support.@hellnbak said:
Yay Trimble Team, thanks for all your hard work (take tomorrow off for a job well done )
The US office has taken gobble gobble vacation now. I started my vacation yesterday - in London visting some friends. I would have gotten lonely to be working this week with no one replying.
@hellnbak said:
Now I'll take off my cheerleader outfit and go back to bed
@hellnbak said:
hope that didn't excite anybody
-
RE: SketchUp RUBY API Wishlist [way of coding wishes, please]
@tommyk said:
Yes, with a custom Ruby Tool. I would like to be able to change the highlight colour when the standard selection tool is used, and I believe there is no way to do this. Would you suggest that I script an alternative selection tool to mimic the native tool and add the additional functionality?
For the immediate solution with the current Ruby API that would be one way to do it. Though implementing the box selection is a challenge via Ruby - at least without performance impact of the tool.
@tommyk said:
Perhaps the Sketchup team would find that the change to the API in this way would be too much of an intrusion to Sketchup's standard tools?
It would be a concern if there was multiple extensions that modified the selection colour of objects. Which extension would get the last say? And how easy would it be for the user to read the selection if the selection color changed?
Having said that, we've had a couple of requests like this. If you would be able to mock up a real use case, a mock screenshot I can add that to a feature request in our bugtracker.
I personally think it would be nice to have some generic way to draw additional graphic to the screen to display meta data etc. Not just changing selection colour.