sketchucation logo sketchucation
    • Login
    1. Home
    2. Brett McAllister
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    B
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 20
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Exporting layers to Photoshop

      @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.

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Exporting layers to Photoshop

      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/

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Webdialog: set_url and write html in a file? how?

      Add this piece of javascript to your html
      Should trigger when the dialog is fully loaded

      window.onload = function() { 
      window.location.href ='skp;start@';
      }
      
      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Observers and undo question

      @dan rathbun said:

      The model edits between the model.start_operation and model.commit_operation are 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 ... end block is for standard safety (highly recommended by Google,) as otherwise if an error occurs, the model could become corrupted. The model.abort_operation call 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.

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Observers and undo question

      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.

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Observers and undo question

      @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?

      posted in Developers' Forum
      B
      Brett McAllister
    • Observers and undo question

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Geom.intersect_line_line question

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • Geom.intersect_line_line question
      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

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Global coordinates Question

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Plugin running indefinitely

      Does your while loop look like this?
      i = 0
      while i < 5
      puts i
      end
      i += 1

      posted in Developers' Forum
      B
      Brett McAllister
    • Global coordinates Question

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: [Plugin] 2D Tools

      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

      posted in Plugins
      B
      Brett McAllister
    • RE: Skp File Names

      Thanks Dan
      I had a good through the model class and I could not see anything.
      Cheers

      Brett

      posted in Developers' Forum
      B
      Brett McAllister
    • Skp File Names

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Web Dialog bug?

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • Web Dialog bug?

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • RE: Web dialog browser version

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • Web dialog browser version

      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.

      posted in Developers' Forum
      B
      Brett McAllister
    • Setting camera eye

      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

      posted in Developers' Forum
      B
      Brett McAllister
    • 1 / 1