sketchucation logo sketchucation
    • Login
    1. Home
    2. shirazbj
    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!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 34
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Ruby "split" in file line reading

      Heard of regular expressions before, This time I tried to understand it. Thanks.

      posted in Developers' Forum
      S
      shirazbj
    • RE: Enums's index of an inputbox return

      all good now.

      I'll download the ruby book.

      Thanks dan.

      posted in Developers' Forum
      S
      shirazbj
    • Ruby "split" in file line reading

      hi,

      I used to use:
      b = file.gets()
      c=b.split(" ")
      to read lines from a data file in text.

      but the following lines doesn't have a " " between two data if the value is negative.

      0.208646094863E+000-0.513313617099E-001-0.915625940530E-003 0.180604789668E+000-0.240882759294E-001-0.872767876563E-003

      How do I split them now?

      Thanks in advance

      Cean

      posted in Developers' Forum
      S
      shirazbj
    • Enums's index of an inputbox return

      hi,

      I was wondering if I could get the index of an enums selection directly.

      In my example below, I want to choose between "2D" & "3D" for one variable. The return is either "2D" or "3D". But I want the index number instead, that is "0" for "2D", "1" for "3D".

      How could I get the "0" or "1" if I don't compare the return with the list of the enums.

      Thanks in advance

      Cean

      def hw_inputbox
      	
        iaxi=1	
        t_iaxi = ["2D","3D"]
        enums = [t_iaxi.join("|")]
        values = [t_iaxi[iaxi]]
        prompts = ["Geo type; "]
        results = inputbox prompts, values, enums, "my Geo"
        return nil if not results 
        $iaxi = results[0]
        your_slection=$iaxi
        UI.messagebox(your_slection)
      
      end
      
      UI.menu("Plugins").add_item("hw_inputbox") { hw_inputbox }
      
      posted in Developers' Forum
      S
      shirazbj
    • RE: Color in add_line?

      Found this:

      Edge color by material
      http://forums.sketchucation.com/viewtopic.php?f=180&t=35443#p312624

      thx

      posted in Developers' Forum
      S
      shirazbj
    • Color in add_line?

      Hi,

      How do I add an color line?

      I use face.material="red" to change face color, but line.material doesn't work.

      Thanks in advance

      Cean

      posted in Developers' Forum
      S
      shirazbj
    • RE: UI.openpanel - wildcard bug

      I tried "a.jpg".

      Why ".jpg" is not listed in the "files of type"?

      posted in Developers' Forum
      S
      shirazbj
    • A Transformation demo

      hi,

      I want to generate component in anywhere with any angle upon my need.

      I come up with this code. Now the angle is only about Z axis.

      Any advice is welcomed.

      Thanks for Matin's wonderful tutorial http://www.martinrinehart.com/models/tutorial


      transformation

      posted in Developers' Forum
      S
      shirazbj
    • RE: Compute Rotation and Scale from Transform Object

      @martinrinehart said:

      @dburdick said:

      I read your wonderful web-page description of the 4 x 4 matrix - ...

      I am reading it too. Great job.Thanks.

      posted in Developers' Forum
      S
      shirazbj
    • RE: An U bolt

      I read your PipeAlongPath code. I'm not using pre-selected path, instead generating by add_line+add_circle+add_line for U.

      add_circle return an array of edge, I need to include them into the path array.

      it works now (attached).

      Thanks


      draw a u-bolt

      posted in Developers' Forum
      S
      shirazbj
    • RE: An U bolt

      I'm tring with ruby.

      posted in Developers' Forum
      S
      shirazbj
    • RE: An U bolt

      tried follow me. But it can't follow an arc. Any suggention?

      Thx

      btw: I drop my line very soon each time I visit this site.Any problem?

      posted in Developers' Forum
      S
      shirazbj
    • RE: Help on scale

      Instead of writing every 'mm' in code, I thought it's more easy to draw as it is and scale back at the end.

      That also cleared me from inserting a DWG file, need scale back to get the dimensions show in right number.

      Thanks.

      posted in Developers' Forum
      S
      shirazbj
    • RE: Help on scale

      Thanks Dan. So, I was right. It was in inch.

      It's a bit hard to understand the API:
      "
      The mm method is used to convert a number to millimeters.

      It returns a Length value which is the same length as the given value. For example len = 25.4.mm returns 1 inch.
      
      Returns:
      
      mm
          a value in millimeters if successful
      
       value = 10
       mm = value.mm
      

      "

      The result is the same length but with a different unit.

      posted in Developers' Forum
      S
      shirazbj
    • An U bolt

      Hi,

      I want to draw an U bolt (no thread now) with Ruby, thought I need FollowMe command. Is there a FollowMe example?

      Thanks in advance

      Cean

      posted in Developers' Forum
      S
      shirazbj
    • Help on scale

      Hi,

      I use the following code to draw a r=100 cyclinder. With the SketchUp runing in Archi mm template, what I got is a r=5080 cyclinder which is 25.4 times bigger. Thought it is in inch.

      I was wondering should I specify what template to use in my code? If so, how to do that?

      Thanks in advance

      Cean

      def my_cylinder
      
          x=0
          y=0
          z=0
          idir=1
          r=100
          h=500
          
          model = Sketchup.active_model
          
          $entities=model.entities
          
          p1 = Geom;;Point3d.new(x,y,z)
          vector= Geom;;Vector3d.new(1,0,10)
      
          circleI = $entities.add_circle p1, vector, r
          base = $entities.add_face circleI
          base.pushpull h
      
      
      end #def hw_cylinder
      
      UI.menu("Plugins").add_item("my") { my_cylinder }
      
      posted in Developers' Forum
      S
      shirazbj
    • RE: How to avoid generating line between joint?

      Hi TIG,

      Finally made it and got my mesh.

      To cut through, need to cut from the opposite direction.
      To cut in (make a shell), need to cut from outside to inside.

      No need to do all the |e|e.erase! ... check.

      Thanks


      mesh.gif

      posted in Developers' Forum
      S
      shirazbj
    • RE: How to avoid generating line between joint?

      Now the problem is un-wanted face. I added labels on the photo.

      posted in Developers' Forum
      S
      shirazbj
    • RE: How to avoid generating line between joint?

      the PFC channel is not out.

      Not understand all this code below. Must be something wrong.

          @entities.to_a.each{|e|e.erase! if e.valid? and e.class==Sketchup;;Edge and edge.faces[1]==true and edge.faces[0].normal==edge.faces[1].normal}
      
      

      cut.gif

      posted in Developers' Forum
      S
      shirazbj
    • RE: How to avoid generating line between joint?

      I am trying to carve the ladder out from a big cube.

      New code, new approch and new problem.


      my_c_ladder.rb

      posted in Developers' Forum
      S
      shirazbj
    • 1 / 1