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

    Posts

    Recent Best Controversial
    • RE: How to tell if a plane is horizontal

      @unknownuser said:

      Geom::Vector3d#== already accounts for floating point tolerance

      Right. Good to know for sure.

      @unknownuser said:

      you should create a z-oriented Vector3d and compare it to the normal of the plane using ==

      Can't one compare against Z_AXIS ?

      Come to think of it. If using a sectioncut all geometry will be on same plane. And "probably" contains faces which could be used to extract a face normal. So a plane might not even get into use. Just compare face normal against Z_AXIS ?
      Or if Z_AXIS is not valid comparison object, create a z axis vector like Slbaumgartner said.

      Jeff πŸ˜„

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: How to tell if a plane is horizontal

      If you already have required a plane called "myplane", you can get the plane normal and compare it's vector against Z-axis within some tolerance..
      I'm not sure if it suffice to simply compare 2 vectors for equality (?) due to floating Point comparison.
      BUT in this case Sketchup is creating the vector so perhaps the tolerance is set and you can compare plane_normal against Z_AXIS. Im not certain about that though..
      Depending at what the direction the normal is Pointing it might be a good idea to do a tolerance for absolute values. IE discard -1 to 1 for example. Ruby abs could be used.
      Even if the sectioncut is horisontal it might be flipped upside down. If you want to trap for that..
      So the vector direction might NOT be the same as Z-axis even if parallel.
      I'm presuming you already familiar with the API methods for comparing vectors..

      This could be used as an alternative to abs.

      
      def positivVal(a)
         a = a < 0 ? -a ; a
      end	
      
      

      Anyway.
      This should get you the plane normal. I got this code from somewhere in this forum, so there IS a thread covering this subject, somewhere..

      
      a, b, c, d = myplane
      plane_normal = Geom;;Vector3d.new(a,b,c)
      
      
      
      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Web dialog fractions conversion

      http://sketchucation.com/forums/viewtopic.php?t=36722

      There are some conversion methods in there to take inspiration from..

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Web dialog on a Mac

      You could do some css reset to "try" to remove some browser specific styling..
      Has it's pros and cons. Testing needed..

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: How can I run code on view-change

      Nice. I knew someone had done this..
      That looks like it will be fairly predictable ?

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: How can I run code on view-change

      Just a sidenote. If you are only after watching orbiting, you could use tool resume(view) method. It fires after orbiting or pan and zoom as well. Then you might not need any observer.
      You could set a methodcall in there instead..

      What do you mean face visible ? Reversed ?

      Havent done any code for checking face reversed, so I'm just speculating.
      I'd reckon it will be unpredictable. Think there are some plugins for this already?
      Maybe TIG's orient faces or such..

      But you could project a ray(view pickray I think?) to the face and compare that vector to the face.normal to within some tolerance. That tolerance would be the hard part, I guess.
      But needed since view ray will not be parallel to the face normal all of the time..
      Then set conditions comparing vector directions.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Transformation of single entities ???

      Ah, yeah it's only one face..
      Then TIG's solution is more accurate.
      Was wondering though, is the "output" the same between those 2 methods ?

      Why I ask, is that I somehow was under impression that to avoid referencing to deleted or nil faces, since sometimes when translating faces the reference to a face in an Array may become deleted due to just that translation, cause some translations creates new faces etc. And to avoid that one use transform_by_vector.
      (may not be relevant here since were only dealing with 1 face, but curious while at it )

      edit: reffered to vertices when meant faces..

      Or am I misslead ?

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Transformation of single entities ???

      You may also have to account for inner faceloops..

      So I pass along a solution TIG gave me ages ago. The "face-clone". Don't know where it orginates from..
      Anyway have worked perfect with faces with holes. It may serve as a startingpoint..

      It does what slbaumgartner just mentioned more or less. Not deleting the original face though!

      There are some recent threads as to why one have to rewrite the faceloops if having "holes", but I can't relocate them..
      http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=55238

      
      # You will have to create and collect;
      #gents = a new group which will be containing the face clone( group.entities )
      #faces is a collection of original faces
      
      faces2go=[]; 
      
      faces.each{|face|
      	face.loops.each{|loop|gents.add_face(loop.vertices)}   # make innerfaces and all faces
      	oface = gents.add_face(face.outer_loop.vertices)       # make outer faces again to be sure
      	gents.each{|face| 
      		next if face.class!=Sketchup;;Face     
      			face.edges.each{|e|
      			if not e.faces[1]
      			   break
      			end
      		faces2go << face
      		}
      	}
      }
      
      gents.erase_entities(faces2go)   #erase inner faces
      

      BUT! Rereading the topic I wonder if you are not just wondering how to translate entities ?

      The danger in that is that the original face & Id might get altered, and your reference to the original selection then get's lost.

      Translating the face vertices "en masse" I'd think you should look into [highlight=#ff0000:wcl7fvpm]transform_by_vectors[/highlight:wcl7fvpm]
      http://www.sketchup.com/intl/en/developer/docs/ourdoc/entities.php?hl=sv-SE#transform_by_vectors

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Web dialog on a Mac

      Are you using dialog.set_file ?

      htmlset = File.join( File.dirname(FILE), "somehtml" )
      dialog.set_file( htmlset )

      I think that is one of the many recommendations.
      Also do a platformcheck and set dialog to modal.

      RUBY_PLATFORM =~ /(darwin)/ ? dialog.show_modal() : dialog.show

      It's difficult for anyone to tell without some code I guess.

      At least you have something to try out πŸ˜„ I have not yet done any dialogs for Mac so I couldent tell for sure if that works..

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Thank you TIG. Really appreciate it!

      I havent done any update for a long time and must get up to date with how the pluginstore works, more in detail.

      I suppose I should move the manual there to, perhaps ? Did not manage to downsize it to less then 1.8 mb. 😞

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      Manual

      Since ver 1.3.1


      manual_2dBoolean.zip

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

      New version 1.3.1 added:

      http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=39661

      Whole lot is rewritten so there may be lot of things broken. I suggest a lot of testing and report back bugs and wishes πŸ˜„

      Intersections should now be a Little quicker. And some new stuff as well.

      Make sure to read the manual in second post.

      Will try and add to pluginstore later.

      posted in Plugins
      jolranJ
      jolran
    • RE: [Plugin] Boolean--OSCoolean (Dec 2013) for SU 8 up free ver

      I wonder too.

      But is it not possible to bump vertices position out of Sketchup's tolerance while scaling geometry ? That must affect intersections and such too, not only the factor of edges length.

      Still trying to wrap my head around this..

      posted in Plugins
      jolranJ
      jolran
    • RE: (REQ) Brick &amp; Tile Maker

      Hi.

      was wondering if this would be of interest ?

      Had a look in 2Dboolean and it's possible to add method for choosing a material for pushpull after cleanup. No tiling in this piece, though..

      Need some choices in menu, ideas ? Choose material for pushpull & distance ?

      Normally I got other things to do, but if you are interested I could spend a day or two on this...


      2dboolean2.jpg

      posted in Plugins
      jolranJ
      jolran
    • RE: Cloud sketchup like Adobe creative cloud

      @unknownuser said:

      I guess they never reached fame in Sweden.

      Oh yes they did! πŸ˜„

      posted in Plugins
      jolranJ
      jolran
    • RE: Soften coplanar ?

      entities.fill_from_mesh(mesh, true, 2 | 8) is working nicelly, but a small gotcha..


      %(#FF0000)[mesh.add_polygon(1,2,3)
      mesh.add_polygon(2,3,4)]

      Does gives hard edges, as expected.

      %(#FF0000)[mesh.add_polygon(1,-2,3)
      mesh.add_polygon(-2,3,4)]

      gives hard soft edge between Points 2, as expected.

      but so does this:

      %(#FF0000)[mesh.add_polygon(1,2,3)
      mesh.add_polygon(-2,3,4)]

      or

      %(#FF0000)[mesh.add_polygon(1,-2,3)
      mesh.add_polygon(2,3,4)]


      So I'm starting to see some trouble with this method. To be able to stear edge visibility one need to use 2 Points in comparison. For ex a Collection of edge.start and end positions.
      For a triangulated quad this works but not if the face has innerloops,
      Or faces where triangulation is splitting the face without hitting innerloops.

      Was to fast here..
      The docs actually explains this behavior, "value of [-1, 2, 3] indicates that the edge from 1 to 2 is hidden"

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Soften coplanar ?

      @unknownuser said:

      Yes - should be "fill_from_mesh". 😳 Just love the consistency of the Ruby API naming... πŸ˜’

      I had to ask, thought there where some new hidden stuff πŸ˜„

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Soften coplanar ?

      ahh, nice info. I've used bitwise in JavaScript ( for performance reason ). Good to know they work in Ruby as well.

      @unknownuser said:

      Some are not documented, like the 2nd arg to UI.messagebox can also (in addition to the button flag,) be OR'd with an icon integer flag that sets which standard icon (or none,) is displayed in the messagebox.

      How the heck do you guys know all this ? πŸ˜„
      Must spend a lot of time experimenting outside the docs..

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Soften coplanar ?

      2 | 8
      Expression it is! Yei! It works.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Soften coplanar ?

      fill_faces_from_mesh ? Typo ?

      posted in Developers' Forum
      jolranJ
      jolran
    • 1 / 1