@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