Thanks a million. That has cracked it.
I used the offset method
Best wishes
Andrew
Thanks a million. That has cracked it.
I used the offset method
Best wishes
Andrew
Thank you for helping.
I have a component called SC11 wich is generated in a seperate Class. I create an instance of that component in the Class called $v_inst and it is positioned at [0,0,0]. This is picked up in the Mouse Move in the Mytools class as follows:
<span class="syntaxdefault"></span><span class="syntaxkeyword">class </span><span class="syntaxdefault">MyTool<br /> def activate<br /> puts </span><span class="syntaxstring">"Your tool has been activated."<br /> </span><span class="syntaxdefault">end<br /> <br /> def onKeyDown</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">key</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">repeat</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">flags</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">view</span><span class="syntaxkeyword">)<br /> case </span><span class="syntaxdefault">key<br /> when VK_LEFT then arotate </span><span class="syntaxcomment"># just this one for starters<br /> </span><span class="syntaxdefault">end<br /> end<br /><br /> def arotate<br /> <br /> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">v </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Vector3d</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">) </span><span class="syntaxcomment"># about a vertical axis<br /> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">pt </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Point3d</span><span class="syntaxkeyword">.new(@</span><span class="syntaxdefault">curpt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">)<br /> @</span><span class="syntaxdefault">tr </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">rotation </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">pt</span><span class="syntaxkeyword">, @</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">90.degrees<br /> $v_inst </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">$v_inst</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform</span><span class="syntaxkeyword">! ( @</span><span class="syntaxdefault">tr </span><span class="syntaxkeyword">)<br /> </span><span class="syntaxdefault">$v_inst</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">name </span><span class="syntaxkeyword">= </span><span class="syntaxstring">"90"<br /> </span><span class="syntaxdefault">$v_mk </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">true<br /> end<br /> <br /> def onMouseMove</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">flags</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">x</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">y</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">view</span><span class="syntaxkeyword">)<br /> @</span><span class="syntaxdefault">curpt</span><span class="syntaxkeyword">=</span><span class="syntaxstring">""<br /> </span><span class="syntaxdefault">view</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view<br /> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">curpt </span><span class="syntaxkeyword">= (</span><span class="syntaxdefault">view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">inputpoint</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">x</span><span class="syntaxkeyword">, </span><span class="syntaxdefault">y</span><span class="syntaxkeyword">))<br /> @</span><span class="syntaxdefault">pt </span><span class="syntaxkeyword">= </span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Point3d</span><span class="syntaxkeyword">.new(@</span><span class="syntaxdefault">curpt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">)<br /> @</span><span class="syntaxdefault">ttr</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.new @</span><span class="syntaxdefault">pt<br /> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">tttr</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.new @</span><span class="syntaxdefault">pt </span><span class="syntaxcomment">#just in case it makes a difference<br /> </span><span class="syntaxkeyword">if </span><span class="syntaxdefault">$v_mk <br /> then<br /> $v_inst1</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation </span><span class="syntaxkeyword">= @</span><span class="syntaxdefault">tttr<br /> </span><span class="syntaxkeyword">else<br /> </span><span class="syntaxdefault">$v_inst</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation </span><span class="syntaxkeyword">= @</span><span class="syntaxdefault">ttr <br /> end<br /> end<br />end<br /></span><span class="syntaxcomment">##################### </span><span class="syntaxdefault"></span>
When it runs the instance moves with the cursor and can be rotated time after time with the left arrow. But as soon as the cursor moves again it reverts to the untransformed instance.
I would be most grateful if you can see where I am going wrong.
Andrew
I am trying to program the insertion of a component instance in a way that I can rotate it using key strokes. I have succeeded in all but one aspect.
Using MyTools I can load the instance and move it attached to the cursor. I can also capture key strokes to rotate it. However, when I start to move the mouse again the visible instance has reverted to the unrotated instance. It seems to forget the rotation transformation.
I have even renamed the rotated instance and told the subsequent mouse move to refer to the renamed instance but is still shows the unrotated instance.
Is this a bug or am I doing something wrong?
Andrew
YOu can chose the weld size in the VCB. You have to draw a line along the intended weld postion first so that predetermined the orientation.
Being a novice on this forum, I am not sure about the protocol of issuing email addresses etc. If you indicate yours, I can email it to you.
You have confirmed my fear that a simple issue compromises what I can do. Unless there is a way to put an image into an input box it looks as if I will have to put the input which has about a dozen data items into the webdialog.I will have to master pushing data back to Ruby from the Webdialog.
Thanks
Hi Shrockfab,
I modified Chris Fulmer's 'Add a perpendicular face to produce a fillet weld.It works like this:
As it is built on the back of Chris's plugin I am not sure if I can publish it.
Andrew
Hi Chris,
Windows 7.
Yes it is a plugin that I am developing in Ruby for use with Sketchup.
I have a problem with displaying a webdialog and an input box at the same time. The web dialog shows a diagram which gives guidance on how to fill in the input box. So the web dialog is opened first followed by the input box. I can position the web dialog box but wherever it is the input box opens over it which is far from ideal. Is there a way of fixing the positions of both boxes so that they are not ontop of each other?
Also, the web dialog is opened in a def prior to the input box but I cannot then close the webdialog programmatically.
Thanks
Andrew