sketchucation logo sketchucation
    • Login
    1. Home
    2. cjthompson
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 19
    • Posts 151
    • Groups 1

    cjthompson

    @cjthompson

    10
    Reputation
    1
    Profile views
    151
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    cjthompson Unfollow Follow
    registered-users

    Latest posts made by cjthompson

    • RE: Geom::Transformation.new(pt, xaxis, yaxis)

      @thomthom said:

      No - I wondered if it preserved it.
      I wanted to only move and rotate the object to a new plane. I wondered if this method would be an option as oppose to combining a translation and two rotation transformations.

      Well, first you have to determine which axis gets priority (because the angles between the axes in the original transformation may not be the same as the angles between the axes the user picked) then measure the angles between the prioritized axis and the other two, and apply the angles to the user axes (including face normal).

      I'm pretty sure that doesn't make sense but I can't think of how else to describe it.
      If you have any specific questions, I might be able to help a bit more.

      posted in Developers' Forum
      C
      cjthompson
    • RE: Geom::Transformation.new(pt, xaxis, yaxis)

      Do you want the transformation to have the same properties as the original(skew, scale, etc.) in the final result, or are you asking how to prevent skewing?

      posted in Developers' Forum
      C
      cjthompson
    • RE: Geom::Transformation.new(pt, xaxis, yaxis)

      If you don't care about scale, this should work fine, although it may flip the car upside down if the expected z axis does not correspond with the input axes:
      instance.transformation = Geom::Transformation.new(newOrigin,newXAxis,newYaxis)

      I would suggest using something like this (untested):

      
      trans = instance.transformation
      scales = [trans.xaxis.length,trans.yaxis.length,trans.zaxis.length]
      inputX.normalize!
      inputY.normalize!
      inputX = inputX * scales[0]
      inputY = inputY * scales[1]
      newTrans = Geom;;Transformation.axes(newOrigin,inputX,inputY,face.normal * scales[2])
      instance.transformation = newTrans
      
      
      posted in Developers' Forum
      C
      cjthompson
    • RE: Geom::Transformation.new(pt, xaxis, yaxis)

      I'm pretty sure it is the same as .axes, but it crosses the Z axis automatically.

      Can you tell us what you are trying to do in particular, or are you just curious?

      posted in Developers' Forum
      C
      cjthompson
    • RE: [code] Sketchup Safe Shutdown method

      @dan rathbun said:

      If you attempt to use Ruby's system(), IO.popen or shell %x(*command string*) (ie, the Kernel 'dot' backquote method,) .. Ruby cannot continue until the call returns, because they create subprocesses.

      For at least IO.popen, ruby will continue until you start reading on the pipe, although I have a feeling I took your statement out of context.

      posted in Developers' Forum
      C
      cjthompson
    • RE: SketchUp Command Line: RubyStartup

      there is also a "ShowOnStartup" key under the WelcomeDialog folder in the registry.
      EDIT: Nevermind, I should have read the full post. 😳

      posted in Developers' Forum
      C
      cjthompson
    • RE: Question about order in selection

      As far as I've seen, the order of selection is the same as the order in the entities list (order of creation).

      posted in Developers' Forum
      C
      cjthompson
    • RE: [Bug] NaN in a normal's value

      @unknownuser said:

      I have tested it on SU Pro 7.1.6860 Win without a single plugin and it gives INT.
      Same in SU6 Free Win.
      Why our results are different?

      That's weird. When I just put the face in edit mode, I get a result consistent with Tomasz's, but when I explode the 2 components, I get the same result as TIG.

      EDIT: I should also note that the face renders smoothed when I just put it in edit mode, but renders normally when I explode it.

      posted in Developers' Forum
      C
      cjthompson
    • RE: Defining Length, Width and Thickness

      I haven't worked with Dynamic components much, and only have the free version, but wouldn't something like this work?
      =smallest(largest(LenX,LenY),largest(LenY,LenZ),largest(LenX,LenZ))

      posted in Developers' Forum
      C
      cjthompson
    • RE: SU 7.1.6 Geom::BoundingBox.intersect does not return empty

      I'm not sure if you need this anymore, but here is a method that should only return the intersected bounds:

      
      def intersect(boundingBox1,boundingBox2)
      	newBoundingBox = Geom;;BoundingBox.new
      	bounds1 = [boundingBox1.min.to_a,boundingBox1.max.to_a]
      	bounds2 = [boundingBox2.min.to_a,boundingBox2.max.to_a]
      	intersectBounds = [[0,0,0],[0,0,0]]
      	
      	validBounds = true
      	(0...3).each do |index|
      		if(bounds1[1][index] <= bounds2[1][index])
      			intersectBounds[1][index] = bounds1[1][index]
      		else
      			intersectBounds[1][index] = bounds2[1][index]
      		end
      		
      		if(bounds1[0][index] >= bounds2[0][index])
      			intersectBounds[0][index] = bounds1[0][index]
      		else
      			intersectBounds[0][index] = bounds2[0][index]
      		end
      		
      		if(intersectBounds[0][index] > intersectBounds[1][index])
      			validBounds = false
      		end
      	end
      	
      	if(validBounds)
      		newBoundingBox.add(intersectBounds)
      	end
      	return newBoundingBox
      end
      

      It doesn't have any error checking, so you might want to modify it if you use it.

      EDIT: Fixed

      posted in Developers' Forum
      C
      cjthompson