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

    Skippy1974

    @Skippy1974

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

    Skippy1974 Unfollow Follow
    registered-users

    Latest posts made by Skippy1974

    • RE: Create a group and manipulate add geom

      Perfect
      I made a stupid mistake
      I investigate not
      thanks a lot

      posted in Developers' Forum
      S
      Skippy1974
    • RE: Create a group and manipulate add geom

      hello,
      As I m a bigginer, I played with the script but I m not sure the based works.

      http://sebcanaud.free.fr/Perso/sketchup0.jpg

      the goal is to import a .skp (it's a projector). as I m not able to load I open a new file with the good projector shape.

              Sketchup.open_file "C;/Program Files/Google/Google SketchUp 7/Plugins/Projectors/ProjectionDesign_F12.skp"
      

      After that, I create the pyramid of projection using specific parameter.
      at the end I would like to move and rotate everthing. But I rotate only the pyramid I would like to merge the 2 group but as the Projector group is not loaded but as open file, I have not the hand on it

          # create group 
          group1 = ent.add_group projection_surface.all_connected
          group1.name = "pyramid"
          
          # scale
          s = Geom;;Transformation.scaling [0, 0, 0], scale_factor, scale_factor, scale_factor
          ent.transform_entities s, group1
          
          
          # rotation
          rh = Geom;;Transformation.rotation [0, 0, 0], [0, 0, 1], heading
          rp = Geom;;Transformation.rotation [0, 0, 0], [0, 1, 0], pitch
          rr = Geom;;Transformation.rotation [0, 0, 0], [1, 0, 0], roll
      
          ent.transform_entities rh, group1
          ent.transform_entities rp, group1
          ent.transform_entities rr, group1
      

      http://sebcanaud.free.fr/Perso/sketchup1.jpg

      thanks

      posted in Developers' Forum
      S
      Skippy1974
    • RE: Create a group and manipulate add geom

      hello,
      nothing works
      I quite sure, the base of my code is ugly
      could you help me to start with somthing well

      
      # Name ;          Projector 0.9b
      
      # Description ;   Generic projector drawing
      
      # Author ;        Sebastien CANAUD
      #				  
      
      # Usage ;         1. Execute the script
      #				  2. Fill in the GUI
      
      # Type ;      	Script
      
      # History; 
      #                 Beta  (25.August.2010) - beta version
      
      # First we pull in the standard API hooks.
      require 'sketchup'
      
      # Show the Ruby Console at startup so we can
      # see any programming errors we may make.
      Sketchup.send_action "showRubyPanel;"
      
      
      # Add a menu item to launch our plugin.
      def create_generic_projector
       	# Access the Entities object
      	model = Sketchup.active_model
      	ent = model.entities
      
      	# Create the input box
      	@projector_choise = "F22" if not @projector_choise 
      	
      	projector_choise = ["F12","F22","F32", "LX1500", "CP635"]
          enums = [projector_choise.join("|")]
      	
      	prompts = ["Projector", "Ratio H", "Ratio V", "lens", "Vertical Shift", "Horizontal Shift ", "Screen height","X", "Y","Z", "Heading", "Pitch", "Roll"]
      	defaults = [@projector_choise,"4", "3", "1.03", "110", "0", "2.2", "0", "0", "0", "0", "0", "0"]
      	results = inputbox prompts, defaults, enums,"Projector Settings"
      	return if not results
      	projector_choise, results[0],results[1], results[2], results[3], results[4], results[5], results[6], results[7], results[8], results[9], results[10], results[11] = results
      	
      	# load projector
      	if( projector_choise == "F12" )
      		Sketchup.open_file "C;/ANTYCIP/Sketchup components/Projectors/ProjectionDesign_F12.skp"
      		proj = Sketchup.active_model.entities.add_group
      	end
      	if( projector_choise == "F22" )
      		Sketchup.open_file "C;/ANTYCIP/Sketchup components/Projectors/ProjectionDesign_F22.skp"
      		proj = Sketchup.active_model.entities.add_group
      	end
      	if( projector_choise == "F32" )
      		Sketchup.open_file "C;/ANTYCIP/Sketchup components/Projectors/ProjectionDesign_F32.skp"
      		proj = Sketchup.active_model.entities.add_group
      	end
      	if( projector_choise == "LX1500" )
      		Sketchup.open_file "C;/ANTYCIP/Sketchup components/Projectors/ChristieDigital_LX1500.skp"
      		proj = Sketchup.active_model.entities.add_group
      	end
      	if( projector_choise == "CP635" )
      		Sketchup.open_file "C;/ANTYCIP/Sketchup components/Projectors/Hitachi_CP635.skp"
      		proj = Sketchup.active_model.entities.add_group
      	end
         
      	# Projector settings
      	ratioH = results[0].to_f
      	ratioV = results[1].to_f
      	lens = results[2].to_f
      	verticalShift = results[3].to_f
      	horizontalShift = results[4].to_f
      	screenHeight = results[5].to_f
      	x = results[9].to_f.mm
      	y = results[10].to_f.mm
      	z = results[11].to_f.mm
      	heading = results[9].to_f.degrees
      	pitch = results[10].to_f.degrees
      	roll = results[11].to_f.degrees
      	
      	# temp
      	norme = ratioH
      	ratioH_in = ratioH.m
      	ratioV_in = ratioV.m
      	new_translationV_in = -verticalShift/2/100.0*ratioV/norme
      	new_translationH_in = -horizontalShift/2/100.0
      	scale_factor = screenHeight * (ratioH/ratioV)
      
      	# Create the five points of the pyramid
      	pt1 = [0, 0, 0]
      	pt2 = [lens*ratioH_in/norme, -ratioH_in/2/norme, ratioV_in/2/norme]
      	pt3 = [lens*ratioH_in/norme, ratioH_in/2/norme, ratioV_in/2/norme]
      	pt4 = [lens*ratioH_in/norme, ratioH_in/2/norme, -ratioV_in/2/norme]
      	pt5 = [lens*ratioH_in/norme, -ratioH_in/2/norme, -ratioV_in/2/norme]
      
      	# Draw the faces
      	ent.add_face(pt1, pt2, pt3)
      	ent.add_face(pt1, pt3, pt4)
      	ent.add_face(pt1, pt4, pt5)
      	ent.add_face(pt1, pt5, pt2)
      	projection_surface = ent.add_face(pt2, pt3, pt4, pt5)
      
      	# translation for the horizontal and vertical shift
      	tr = Geom;;Transformation.translation [0, new_translationH_in.m, new_translationV_in.m]
      	ent.transform_entities tr, projection_surface
      
      	# create group 
      	group1 = ent.add_group projection_surface.all_connected
      	group1.name = "pyramid"
      	
      	# scale
      	s = Geom;;Transformation.scaling [0, 0, 0], scale_factor, scale_factor, scale_factor
      	ent.transform_entities s, group1
      	
      	
      	# rotation
      	rh = Geom;;Transformation.rotation [0, 0, 0], [0, 0, 1], heading
      	rp = Geom;;Transformation.rotation [0, 0, 0], [0, 1, 0], pitch
      	rr = Geom;;Transformation.rotation [0, 0, 0], [1, 0, 0], roll
      
      	ent.transform_entities rh, group1
      	ent.transform_entities rp, group1
      	ent.transform_entities rr, group1
      	
      
      
      # Create the message box
      #UI.messagebox results[1], MB_MULTILINE, results[0]
      
      #	printf("screenHeight ;%f",screenHeight)
      
      
      end
      #--------------------------------------------------------------------------
      if( not file_loaded?("projector.rb") )
          add_separator_to_menu("Plugins")
          UI.menu("Plugins").add_item("Generic Projector") { create_generic_projector }
      end
      #--------------------------------------------------------------------------
      file_loaded("projector.rb")
      
      
      posted in Developers' Forum
      S
      Skippy1974
    • Hi from france

      Hello,
      short introduction
      I m seb I live in paris. I use Sketchup as a 2D/3D modeler for my design (pro) My job is to design complexe projection system.
      usually we used Rhino 3D. But sketchup seams to be interesting with the ruby script or C++ API.
      I m not sure I can do everything, but It's a good start
      I developted 2 plugins : Generic projector, parametric cylinder
      thx
      seb

      posted in Newbie Forum sketchup
      S
      Skippy1974
    • RE: Create a group and manipulate add geom

      Thx I will try tomorrow

      posted in Developers' Forum
      S
      Skippy1974
    • RE: Create a group and manipulate add geom

      thx
      I created several faces.
      I want ti select all and put in a group and after move the group

      posted in Developers' Forum
      S
      Skippy1974
    • Create a group and manipulate add geom

      Hello,
      I m a newbee
      couple of weeks, I start to dev using the ruby API
      For my plugin create a projector and all the parametric pyrammid
      I have 2 problems

      • I m not able to do the same think as File/import a skp file. I have to create a new one using the folloing

      Sketchup.open_file "C:/ANTYCIP/Sketchup components/Projectors/ProjectionDesign_F12.skp"
      proj = Sketchup.active_model.entities.add_group


      someone has a idea please?

      • after my creation, I want to put every body un a group and manupilate the group (translation / rotation / scale
        I m not able to add some thing or everything in a group

      create group

      group1 = ent.add_group projection_surface.all_connected (bad fonction)
      group1.name = "pyramid"


      idea

      thanks a lot

      posted in Developers' Forum
      S
      Skippy1974