Please give the attached a try and see if (a) it does what you need, and (b) there are bugs.
Thanks
Steve
Please give the attached a try and see if (a) it does what you need, and (b) there are bugs.
Thanks
Steve
Some followup questions about the desired functionality:
Since the dimensions are nested inside a component as a side-effect of importing the submodel, should they be exported back to the model context as well as placed on a layer? Couldn't you just explode the new component since it wasn't really that way in the submodel (or was it)? I'm worrying about the classic confusion over nested contents on layers other than layer0.
John,
I see your point. Let me ponder a while how best to deal with it!
Thanks
Steve
Be aware that if the aspect ratio of the image does not match that of the view, it can not be zoomed to fill the entire view window!
It is a Ruby global variable that is initialized by the Ruby kernel. You can read it or assign to it from any Ruby code.
The various site_ruby and vendor_ruby folders in your $: are where ruby add-on ruby code would be placed in a standard system Ruby on MacOS. The variations and subfolders reflect whether the code is version or hardware specific. On SketchUp, these are inside the Ruby Framework embedded inside SketchUp's app bundle. Although possible, adding things inside the bundle is usually discouraged simply because the content there "belongs" to the SketchUp app. For example, it may be overwritten if you install a maintenance update.
A safer route is to create a subfolder within your personal Plugins folder, put ad-hoc Ruby add-ons there, and either load them using an explicit path or modify $: to find them.
Most of the time these days, you should install a Gem not just Ruby code. You can do this from within SketchUp by Gem::install "name of gem" at the Ruby Console. Pure Ruby gems are supported in SketchUp 2014 and 2015, but SketchUp is not set up to support compiling Gems from C code. People have had varying experiences with compiling Gems outside SketchUp and then copying files into SU. Some successes, a lot of failures...
The PC vs Mac chat is drifting off SketchUp and development for it, so if you'd like to continue maybe we should take it over to the corner bar?
I am mostly retired. I get paid for making custom furniture, but not at a volume I could live on if I were younger. I do all my designs and plans using SketchUp.
@abakobo said:
Why must I use @ or $ for my obj2?
[
These prefixes are part of the names of variables. They tell Ruby what scope the variables belong to (@ for attributes of objects, $ for globals - there is also @@ for class variables). Variables without one of these leading characters are local to the code scope where they appear.
You need to get straight on some basic aspects of Ruby.
A named variable in Ruby holds a reference to a Ruby Object. When you assign a value to a variable, you are attaching the reference to a particular Object. So, for example
obj2=obj1
causes both of these variables to refer to the same underlying instance of MyObject. When you then invoke its value= method
obj2.value='hop'
You are modifying the contents of the original instance of MyObject. Both variables still refer to this same, single instance.
However, in your second example, you are not modifying the Object referenced by a and b. When you write
b='hop'
you are creating a new String object to hold 'hop' and causing b to reference it. Since a still refers to the original String containing 'hip', what you report is the result.
I can only comment on your item #2. This resembles a bug I reported several years ago. It is unique to Mac because of Mac SketchUp's Multi-Document Interface. That is, you can have a single running instance of SketchUp with several distinct models open at the same time (that is why in the Ruby API you have active_model). SketchUp sometimes takes a setting applied to one such model and applies it to all of the open models.
@whydi said:
Tell me. Why did you migrate from Windows to Mac. Fun or need ?
This was about 3 years ago, and several factors played in. Not all of them might apply to others, and time may have passed some by. I had an HP laptop that developed severe hardware problems (randomly freezing the CPU). I had never been happy with the display on it (narrow viewing angle, lousy color rendition,...) so I went shopping for a replacement. My research led me to conclude that I wanted a laptop with an IPS (in plane switching) display. At that time there were very few such available, and they were all very high-end. The price ended up being within spitting distance of a MacBook Pro Retina. Since Mac OS X is actually a UNIX variant under the covers and I had used UNIX for decades, I felt very comfortable with the OS (something I never felt about Windows). The availability of VM so that I could run any Windows apps that proved essential closed the deal for me. I haven't regretted the decision.
@whydi said:
It look like these examples are easy to install and use. Am I right?
My own experience has been that these VMs are indeed easy to install and to use. They do hog some disk space and share the CPU and memory with Mac OS while running, but these would only be serious problems if you are using an elderly Mac with a small disk and limited memory.
@whydi said:
Does a majority of mac users with Sketchup run such virtual machine or just some of them ?
I have no insight as to how many Mac users employ VMs on a regular basis. I installed Parallels early on because I was afraid of losing things when I migrated from Windows. Time has passed, and I find that today I rarely use it any more. I imagine it depends strongly on what you need to run, that is, whether you can find a suitable native Mac alternative.
There are several "virtual machine"systems that allow execution of a Windows app within Mac OS X. Three examples are Parallels, VMWare Fusion, and VirtualBox.
In addition, if you gather the points into an Array you can use Entities#add_edges to create them all in one shot.
As written, the plugin does not search for dimensions inside groups or components.
The main justification is that when a dimension is nested inside a group or component it, like other nested geometry, should be left on layer0. Putting nested entities onto other layers can lead to confusing conflicts between the visibility of the layer of the nested entity and the visibility of the layer of the container. So, my plugin isn't really suited or necessary in a workflow that nests dimensions inside groups or components. Make the group or component's layer not visible, and its contents will disappear with it.
But, in addition, it is not necessary to nest dimensions inside a group or component to make them work. SketchUp dimensions will associate with entities inside a group or component without themselves being in that group or component. Used that way, my plugin lets you put all the dimensions of a particular scene onto their own layer, which is hidden on all except that scene. You can make the dimensions of multiple entities not visible without having to put all those entities onto the same layer themselves.
All that aside, if there is enough demand to support a different workflow I would consider reworking the plugin.
Plus, if you look at the number of old tables with feet broken off, mechanical strength may have taken second place to appearance.
Some more info would be helpful in figuring this out:
SketchUp will tolerate a skewed (non-orthogonal) transformation if you manage to create one; it does not automatically "repair" such because it doesn't know how or why you made it that way. But it doesn't do anything that should cause any greater numerical "drift" than any other computer math. That's why the questions above are important.
As Rich says, the "~" is SketchUp's way of telling you that the actual value can't be displayed fully using the units format you have selected. If the thing you are dimensioning was created by some automated tool such as intersect, this may just be because computer arithmetic isn't exact. But if it is something you drew intending it to be exactly 859.0mm, this means you erred slightly when drawing.
@ziocleto said:
I fail to understand how you would prefer to implement Point3d.+(Vector3d) or Point3d.+(Array) and not the clearly more obvious: Point3d.+(Point3d)
While agreeing that it seems strange that the SketchUp developers have never addressed this question, I would quibble that adding points is not clearly more obvious. It depends on what you are trying to do. If you are thinking about geometric operations, adding two points doesn't make much sense whereas offsetting from a point by adding a vector is essential.
A couple of thoughts:
First, be aware that color by axis also has a built-in tolerance and will accept lines that are slightly askew. As a result, it is not useful for detecting small errors.
Second, (it may not apply to you) on a few occasions when I let go of the mouse to enter a value via the keypad, the mouse drifted slightly off the inference point. The line, while the correct length, was slightly off orientation. This makes the dimension come out with "~".