sketchucation logo sketchucation
    • Login
    1. Home
    2. sdmitch
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.8b introduces important bugfixes for Fredo's Extensions Update
    Offline
    • Profile
    • Following 0
    • Followers 4
    • Topics 54
    • Posts 1,483
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Pointcloud - Joining the Dots

      @gilboe said:

      Could someone explain how I might join the dots of a pointcloud in the order that they are tabulated in the .csv file that created them.
      Thank you.

      This is how I do it.

      	def import_csv
      		mod=Sketchup.active_model
      		ent=mod.entities
      		@csv_dir = "c;/users/public/temp/" if !@csv_dir
      		@csv_file = "csv_export.csv" if !@csv_file
      		ctd_file=UI.openpanel("File to Import from;", @csv_dir,@csv_file)
      		if !ctd_file then; return; end
      		ctd_input=File.open(ctd_file,'r')
      		x,y,z = ctd_input.readline.split(",")
      		pp=Geom;;Point3d.new(x.to_f,y.to_f,z.to_f)
      		while  !ctd_input.eof?
      			x,y,z = ctd_input.readline.split(",")
      			pt=Geom;;Point3d.new(x.to_f,y.to_f,z.to_f)
      			ent.add_line(pp,pt)
      			pp=pt
      		end
      		ctd_input.close
      	end
      
      
      posted in Newbie Forum
      sdmitchS
      sdmitch
    • RE: Adding pitch yaw and roll to xyz of a location

      Sorry for my denseness but are the x,y,z values absolute or delta values.

      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: Plugin to Cleanup or Normalize Definition Names?

      Since definition names must be unique, just removing them would not be allowed but the #1 etc. could be replaced as long as the name remained unique.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: Adding pitch yaw and roll to xyz of a location

      So you want to place a copy of the component at each xyz and rotate it by the given roll, pitch and yaw. But shouldn't the x, y, and z axes be determined by the heading at each point and not axes of the model?

      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: Adding pitch yaw and roll to xyz of a location

      In addition to the rotation, you will need to do a translation to move the selected component to the new location.

      Geom::Transformation.translation(old_point.vector_to(new_point))

      Is this suppose to produce an animation? If so you will need to include pauses using sleep(length_of_pause).

      In the rotation, you can use the Sketchup constants X_AXIS,Y_AXIS,Z_AXIS instead of defining your own.

      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: [Plugin] Component Array (Updated 27-Mar-2014)

      Comp String is the only thing like that that I have but don't think it will work very well since the components will need to overlap precisely.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: [REQ] Rotation Plugin

      @unknownuser said:

      I would like that the rotation was perpendicular to a point

      Any vector or axis would be perpendicular to a point wouldn' it? Do you mean you would want the selected point to be the origin of the rotation around the X, Y, or Z axis?

      I assume that you are aware that if you left click and hold while moving the mouse around you can change the color of the protractor to match the axis you want the release.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: Given a x,y,z location to move a selected group help! solved

      @dukejazz said:

      Is there a way in ruby code, given a x,y,z location to move a selected group directly to that location?
      Need help for my scale upgrade, best I can do is a iteration.

      mod = Sketchup.active_model
      ent = mod.entities
      sel = mod.selection
      
      if sel.first.class==Sketchup;;Group || sel.first.class==Sketchup;;ComponentInstance
       inp=inputbox(["X;","Y;","Z;"],[0,0,0],"Move Component/Group to")
       if inp
        x,y,z=inp;move_to=Geom;;Point3d.new(x.to_f,y.to_f,z.to_f)
        move_from=sel.first.transformation.origin;
        tr=Geom;;Transformation.translation(move_from.vector_to(move_to))
        sel.first.transform! tr
       end
      end
      
      
      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: Adding pitch yaw and roll to xyz of a location

      @ladyquestio said:

      I have the cloud v6 ruby which allows for the x,y,z text input. Is there a script that can import all 6 values at one time?
      I need to be able to import the x,y,z,pitch,yaw,roll in one file for a flight path.
      example of what i need to do is like this:
      0,0,0,10,0,0
      10,5,5,0,45,0

      I know it can be done some how but I can't figure it out.

      I have a basic CSV_Import plugin on my blog that can be easily modified to suit or at least demonstrate how it is done.

      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: Erase_entitiies crashing SU 8

      @timwarner said:

      I have a piece of code that crashes SU 8 (on a Mac).

      Basically the idea is to create an instance of a component, find the positions of its vertices and then erase the instance. The instance is created correctly; the vertices are correctly printed, but then SU dies. Here's the code fragment, where ents is model entities.

      brace_template = ents.add_instance(brace.definition,brace_transformation)
      bte = brace_template.explode
      vertices = bte.select{|e| e.typename == "Vertex"}
      puts "Brace coordinates"
      vertices.each{|v| puts v.position}
      ents.erase_entities(bte)
      

      Any ideas why this is happening?

      There are things in bte other than valid drawing elements. The same thing happens if you try to delete a curve rather than the edges that make up the curve.

      Replace ents.erase_entities(bte) with

      bte.each{|e| e.erase! if e.valid? && e.is_a?(Sketchup;;Drawingelement)}
      

      This worked for me in Windows and hopefully will work on a Mac also.

      posted in Newbie Forum
      sdmitchS
      sdmitch
    • RE: Rotation about the origin

      @bigstick said:

      Are you planning to build on your programming skills and add functionality to this?

      What I have always found really frustrating is when you use the group/component 'handles' to rotate components. It is a neat time-saver, but for years I have always wanted to rotate about a component's origin.

      Alternatively if anyone else out there has a plugin that does this, I would be grateful if someone could please point me in its direction.

      Check out Rotate&Scale on my blog. It works with groups and components and rotation is about the origin.

      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: [Solved] Materials to Layers [by sdmitch]

      @unclex said:

      Front:)
      Thanks

      Be aware that when you draw a rectangle on the xy plane, it is created face/front down. If you actually go beneath the face and paint it then pushpull it into a "solid", the material gets "flipped" to the back or inside. This plugin moves the edges of the face to the layer as well. It works on either the selection or the entire model if nothing is pre-selected.


      Create a layer for each material and move the face to it.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: [REQ]Reset scale multiple components

      @baldaman said:

      Ah OK, do you think that it is possible to change the code to assume the bonding box center origin?

      With apologies to Chris, you might try changing this line

      Sketchup.active_model.active_entities.add_instance(ent.definition,ent.bounds.corner(0)) 
      
      

      to this

      Sketchup.active_model.active_entities.add_instance(ent.definition,ent.bounds.center) 
      
      
      posted in Plugins
      sdmitchS
      sdmitch
    • RE: [REQ]Reset scale multiple components

      I don't see why not but maybe you had better ask Chris about that.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: [REQ]Reset scale multiple components

      I think that is because scale_reinit assumes the default lower left component origin.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: [Solved] Materials to Layers [by sdmitch]

      All faces and surfaces have a front and a back and each can have a different material. Are you only concerned by materials applied to the front only, back only, or both front and back?

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: [REQ]Reset scale multiple components

      @baldaman said:

      If I select only one component, I can reset scale with right click, If I select two components, this option disappear...
      Maybe is it possible to do that with code?

      Check out my Reset Scale plugin on my blog.

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: Curves and plugins

      @thierry_st_malo said:

      It was a kind of smoothing that I was looking for.

      I have two plugins on my blog that might help you. The first is EqSegCurve which allows you to specify either a number of segments or segment length. The input segment length will be adjusted as required if length is entered. The second is Spline which adds interpolated points to smooth the curve.

      Your model is attached with an example of each.


      Essai.skp

      posted in Plugins
      sdmitchS
      sdmitch
    • RE: Rotation about the origin
      require 'sketchup.rb'
      
      
      # Add a menu item
      UI.menu("PlugIns").add_item("rotate90") { rotate90 }  # Call method.
      
      def rotate90
         
         mod = Sketchup.active_model
         ent = mod.entities
         sel = mod.selection
      
         rv = Geom;;Vector3d.new(0,0,1)
         ra = 90.degrees
         rp = Geom;;Point3d.new(0,0,0) 
      
      # define the rotation transformation
         trr = Geom;;Transformation.rotation(rp, rv, ra)
      # apply the rotation transformation to the selection
         ent.transform_entities(trr,sel.to_a)
         
      end
      
      

      You were close. Use http://code.google.com/apis/sketchup/docs/index.html to help with syntax.

      posted in Developers' Forum
      sdmitchS
      sdmitch
    • RE: [Plugin] Stair Maker

      Jeff, I tried to make it so that you could enter any two of three parameters, riser height, number of steps, and stair height. The dominant entry varies with the type of stairs. For "Normal" and "U-Shape", it is stair height. For "Spiral", it is step count. But not being an architect or associated in anyway with the building industry, it is just a wild guess on my part as to what should be the controlling factor.

      posted in Plugins
      sdmitchS
      sdmitch
    • 1 / 1