@chris fullmer said:
That site isn't working for me. Is that Martin Reinhart's site?
No, it's a chap called Matthew Scarpino.
The site seems to work all right for me, if it still doesn't work and your interested in the PDF, I will email you a copy.
@chris fullmer said:
That site isn't working for me. Is that Martin Reinhart's site?
No, it's a chap called Matthew Scarpino.
The site seems to work all right for me, if it still doesn't work and your interested in the PDF, I will email you a copy.
I recommend you go read this PDF to get you started otherwise you will be tearing your hair out and nothing will make sense.
http://www.autosketchup.com/
Add this piece of javascript to your html
Should trigger when the dialog is fully loaded
window.onload = function() {
window.location.href ='skp;start@';
}
@dan rathbun said:
The model edits between the
model.start_operationandmodel.commit_operationare wrapped up into one undo operation with the given name in the menu. There are also some other optional tweeker arguments (listed as "tricky".)The
begin....rescue...endblock is for standard safety (highly recommended by Google,) as otherwise if an error occurs, the model could become corrupted. Themodel.abort_operationcall in the rescue clause can "reset" the model back (so you don't have a partial group edit, or corruption.)
P.S. See: Bug Splat on erase!
He was able to overcome his Splat! by "cheating" the undo stack (see his last post.)
Sorry, misunderstood yes I wrap my operation's with model.start and model.commit
Dan from your experience what particular sketchup methods would you recommend using the rescue clause in?, I haven't really struck to many issues with bugsplats or errors but if certain methods throw the odd fault I will insert a few.
I had a look at the post you pointed out,the observer class I have coded is just an standard instantiated class not a tool. this observer runs in the background and reacts to other tools.
It's odd, if I trigger the transformation with the tool observer no problem with undo's, redo's ,if I use the entities observer no crashes, but no undo.
Bizarre.
@dan rathbun said:
There was a similar post perhaps last week on this subject.
Are you wrapping your transform ?:
begin
> model.start_operation("Brett's Xform")
> #
> ### transform here
> #
> model.commit_operation
> rescue Exception => e
> model.abort_operation
> puts("Error #<#{e.class.name};#{e.message}.>")
> puts(e.backtrace) if $VERBOSE
> end
No I haven't.
I haven't used any rescue's within my coding, the example you provided,what does the backtrace $VERBOSE do?
Hi guys
Just trying to finish of a plugin I have been working on and struck an issue.
I am transforming a collection of vertices which is triggered via the entities observer using the onElementModified method.
The issue I am getting is that once the vertices are transformed you can no longer undo or redo anything.
The undo just repeats it's self but nothing changes.
Would this be an issue with my code or is it just another observer issue.
Regards
Brett
Thanks for the reply and suggestion Tig.
For some reason I thought if you use two point3d's to form a line, you created a line segment, instead of an infinite line.
The dangers of coding when your tired.
Regards
Brett
model = Sketchup.active_model
entities = model.entities
dpoint_1=[-3.989142.m, 3.877123.m, -0.m]
dpoint_2=[-3.989142.m, -3.647636.m, -0.m]
curve_array=[[-3.989142.m, 3.877123.m, -0.m],[-4.457867.m, 3.358428.m, -0.m],[-4.853319.m, 2.781918.m, -0.m],
[-5.16845.m, 2.157867.m, -0.m],[-5.397644.m, 1.4974.m, -0.m],[-5.536815.m, 0.812289.m, -0.m],
[-5.583482.m, 0.114744.m, -0.m],[-5.536815.m, -0.582801.m, -0.m],[-5.397644.m, -1.267913.m, -0.m],
[-5.16845.m, -1.92838.m, -0.m],[-4.853319.m, -2.55243.m, -0.m],[-4.457867.m, -3.128941.m, -0.m],[-3.989142.m, -3.647636.m, -0.m]]
curve_center=[-0.347015.m, 0.114744.m, -0.m]
center= [-5.583482.m, 0.114744.m, -0.m]
offset1_vec =center.vector_to dpoint_1
offset2_vec =center.vector_to dpoint_2
offset1 = center.offset offset1_vec,(0.2.m)
offset2 = center.offset offset2_vec,(0.2.m)
line1_vector = center.vector_to curve_center
line2_vector = center.vector_to curve_center
line1 = [offset1,line1_vector]
line2 = [offset2,line2_vector]
entities.add_curve(curve_array)
entities.add_cline(offset1,line1_vector)
entities.add_cline(offset2,line2_vector)
curve_array_length =(curve_array.length)-1
curve_array_length.times do |point|
line = [curve_array.at(point),curve_array.at(point +1) ]
pt1 = Geom.intersect_line_line(line, line1)
pt2 = Geom.intersect_line_line(line, line2)
puts "pt1;#{pt1}"
puts "pt2;#{pt1}"
end
Hi Guys
Just wondering why the above code sample returns an intersection with each code block iteration.
If it was working correctly it should return 2 point3d's instead every line comparison is showing up as an intersection?
I am sure there must be something basic that I have missed.
Some times another set of eyes works wonders.
Cheers Brett
Thanks for the help,have got it sorted.
Jim - I really appreciate you sharing the info about the nested components/groups saved a lot of time and effort
Thanks
Brett
Does your while loop look like this?
i = 0
while i < 5
puts i
end
i += 1
Hi Guys
Quick question,
I am creating a tool which uses the pick helper class.
When I use the picked face method to find the surrounding vertices within a closed group or component , the positions are returned as local coordinates.
Is there a method within the API to change the values from local to global.
I tried some of the transform methods but it's all rather vague and I am not having any luck, if anyone has any suggestions it would be greatly appreciated.
Cheers
Brett
Hi Tig
I noticed the edit 2d text function no longer works in version 8.
The option to edit the text shows up in the context menu but doesn't pop up a dialog box.
This is the error I got.
Error: #<NameError: undefined local variable or method db' for TextTool2D:Class> 2DtextTool.rb:379:in edit'
Running windows xp sp2
Cheers
Brett
Thanks Dan
I had a good through the model class and I could not see anything.
Cheers
Brett
Hi Guys
I was wondering if it was possible using ruby, to get the name of the skp file that is currently open in sketchup.
I have had a look through the api but have not had much luck finding what I was after.
Any help would be appreciated
Brett
Thanks for the replies.
The only ruby code I am using is just to load the dialog to test it so there is no namespacing etc.
Sounds like that will solve the problem,so I will keep that in mind as I get further along.
Cheers
Brett
Hi there
Currently I am creating some web dialogs and having some real issues with stability.
For no reason at all the dialog will just shut and what ever I have been working on will be lost.
Have any of you guys had this issue or is it just me?
Any help would be appreciated. I am using Sketchup 7
Cheers
Brett
Thanks for the replies
I will have a look into quirks modes
What I don't understand is when I open a web page in a web dialog you get scroll bars if I opened a webpage located on my hard drive no scroll bars?.
There was another thread where there was a similar promblem
http://forums.sketchucation.com/viewtopic.php?f=180&t=3020&p=14379&hilit=web+dialog+no+scroll#p14379
Couple of questions
I was trying to create a web dialog in sketchup 6 and could not get any scroll bars to show yet when I gave it a go in sketchup 7 no problem.
Both versions of sketchup are on the same machine.
The version of internet explorer on my machine is IE 8 and I can't understand why my old version of sketchup is still using IE6?
When you first install sketchup does whatever version of internet explorer get in bedded into sketchup and that's it for ever? or can you force sketchup to use a later version.
Hi there
I want to set my camera eye at the equivalent of zoom extents, would anyone know what array values to use?
By the way superb forum, have learnt so much through the people who post here.
Regards
Brett