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
    • Hatching

      Hi! I really like you guys and gals too try my plugin, and see if it works out OK in Layout.

      http://forums.sketchucation.com/viewtopic.php?f=323&t=38637&p=341462#p341462

      posted in LayOut Discussions layout
      jolranJ
      jolran
    • [Plugin] Hatchfaces (v1.8 beta) UPDATED 15-Dec-2012

      %(#008040)[# Date : 15.12.2o12
      # / / / / / #

      THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR #/ / / / / /#

      IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # / / / / /

      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #ver 1.8 beta #---------------------------#]

      This version has a webdialog HELP-file in the draw menu.
      It has instructions, but I mainly made it for testing webdialog-compability.

      So please read it, there are some new features i would like you to test.
      Make sure to click the icons on the bottom of the page to change page.
      1 new feature is called "Heal section slice". But it doesent use sections. For that use TIG's Sectioncutface or Zorro2.
      It should work on nested groups or components down to ~3 levels

      Background is the main new thing. Where a background component with gluebehavior will be created. With some creative use of profiles in styles, one can get borders around the hatch without affecting the hatched edges cause the background has hidden outer edgeloops, etc etc.

      Still no Pattern hatching yet. Code still need optimizing, but found a few traps where there were silent errors before. Will port stuff bit by bit.

      Hope you enjoy, more to come soon..

      Tested on Windows only. Sketchup 7 and 8.


      ver 1.8.zip

      posted in Plugins
      jolranJ
      jolran
    • RE: Inputbox Hamlet(to do or not todo)

      Great! That makes things a lot clearer.

      @unknownuser said:

      Avoid global $ variables that can clash with other's coding as they are accessible to everything!

      Thats especially the thing I was not sure about about. The last thing I wanna do is barge in here ruin everyones scripts..

      Thanks a lot!

      posted in Developers' Forum
      jolranJ
      jolran
    • Inputbox Hamlet(to do or not todo)

      Hi! Im doing a simple inputbox for this plugin.
      http://forums.sketchucation.com/viewtopic.php?f=180&t=38481

      It's all TIG's (made in 30 min!)script. I will just have to add prompts for 3 values. Angle, spacing and units.
      This is what I've got so far(It doesent refer to any values in the script yet).

      promts=["Angle (deg)", "Spacing", "Units"] 
         defaults=["45", "20", ".cm"]
         list = ["", "", ".cm|.inches"]
         input =UI.inputbox promts, defaults, list, "Hatchfaces"
      

      I though it would be a simple task, but scanning through this forum there seams to be different opinions for what is correct and non correct constructions for UI.

      Since this plugin will hatch faces, I thought putting a context-menu would be a good choice, followed by an inputbox prompt. However reading up a bit in here rmb click menus can be hazardous!??
      And The Use of globals versus instance-varibles is confusing as well.
      It's all a bit confusing to me, any tips would be very welcome.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Ok, take2. A little bit forward. Baby steps.

      So I've been going trough TIG's script 2 days now and I think I understand it better.
      It's of course much more sofisticated an more effective than my intentional idea,
      not surprisingly πŸ˜„

      vp.length=di*2
            tot=0
            until tot>=di*3 # fixes -45 deg. corner issue
      

      Made an adjustment to line 27 di*3(was di). It's an until.statement, where it keep copying the edges on an offset until the "offset-amount" has reached the length of the diagonal?
      (Hope I got that right..) So by multiplying the di by 3 it will get those extra edges
      needed to cover the corners with steep angles. Extra calculation YES! But needed.

      Have not fixed issues of spacing. The spacing is OK when kept around 45 degrees.
      But gets narrower when the degrees amount goes "away" from the original amount.

      MOST cases doing hatches one uses 45 degrees anyway. -45 and 45 degrees.
      So I will go ahead and try too make the ver1. UI now.


      fixed corners.jpg

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Ok! Thats very nice Kyyu!

      Will rework your advice. It looks like a smart solution. But I'm pretty confused right now...

      I managed to get the intersect_with working in "my" code. It hatches as it should do in the X,Z-axis, although with the distance-error, your trying to correct. However selecting a face inside a group in Sketchup and running the script gives a constant bugsplat. So I don't know if I should go forward an do the other views yet. Does not feel solid.

      I'm also worried going against TIG's advice with using groups hey-wild, but I can't implement his code into mine. It's to complicated to understand for me and can't get it to run properly.

      IF I can get the problem with creating hatches inside Sketchup model.groupes, and the distance between lines can be fixed, I think the performance would be OK with my version. But maybe the problem cannot be fixed other
      than rewriting everything as TIG says..
      I'm not lazy, just dumb..

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      BTW. The splats in my script was probably coming from the outliner open.

      So Hmm. The direction I'm taking now is using edge_group_copying(my original idea). I cannot modify TIG's version due to lack of understanding. Not sure it will work like it is. But I'm a screwbie with bad solutions, so TIG can probably just wack in something just like that to prove I'm wrong πŸ˜›

      But I will try to use the face normal to align my copies like in TIG's script, just to
      have something to work on.
      And use Kyuu's example for getting better accuracy with the distance between copies.
      Methods for each view/axis would prob. make the script unnecessary long.
      ABout adding groups. Sketchup doesent like it when your inside a group in model mode-
      select a face- then by code add a group?

      No suggestions I suppose? 😐

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Great!! Will try that. But? That correction will just be a fix for the dialoginput, no?
      I havent gotten that far yet 😳

      Or maybe you mean your advice WILL fix missing geometry in the corners in certain angles)? Cause thats what bugging me, atm. I was only using Int's changing the angles and spacing.

      Maybe that face.normal rotation of yours doesent work in all angles? Unless som serious fix?
      Then using grouped edges might be more suitable, what do you think?
      I'm not questioning anything, just don't know wich way to go.

      Thank you TIG.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      @unknownuser said:

      I make a hatching group then simply add a face and overly long hatching lines to it, intersect everything with each other, erase the faceless edges outside of the face perimeter and then erase the faces too

      Aha! Did not quite understand what was going on.

      Yes, yes I will TRY to do the same. That way I will learn the right way. Slow doesent sound good πŸ˜„

      My resulted line_groups apears pretty fast on screen for the moment though, and its possible to make
      a manual intersect with selected. But a lot cooler if it is manual.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Hate to bother again, but I've been going on all day and intersect_with is troublesome. 😞

      Tried TIG's combo, and others but I think I'm making a fundamentional fault.
      Doesent intersect_with work with nested groups?

      tr3=Geom::Transformation.new()
      face_group.entities.intersect_with(recursion,tr3,face_group,tr3,true,[hatch_lines_group])

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Translation vector? The translation must be on the diagonal or the lines wont cover the whole face.
      I already have the rotation of lines, copy/translation set up. Except that the "bug" is that
      the translation distance doesent get 100% accurate if the face is very distorted.
      Maybe that is what you are trying to fix, and I don't see it.
      If thats the case sorry 😳 I'm a noob, you know.

      The angles of lines on the picture are the identical. Although they don't appear to be.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Hi Kyyu!

      Interresting. So you mean I use the 3rd vector for measuring? Or was it meant to be
      a method to get an angle 45 deg of the vector?
      Remember 45 deg is just an example for this particular hatching. The user must be able to
      choose any angle for the lines across the face.

      I will look into it more and see if I understand you code a little better.
      Thank you Kyyu.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      You are so helpful. I can almost not believe it..
      Thank you TIG!

      I will continue with my script since I understand easier where variables are pointing to.
      See where I have gone wrong in some areas and use your script as a guidence.

      Thanks a million!

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      WOW, you rewrote the whole script?!!! You are quite amazing. But, but.. Its your plugin, then??

      Heh, I almost got mine to work except the "petite" distance between lines thingy..

      Can I load the code in ruby code editor and launch? Cause nothing happends when I run your script.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Yes, I hope soo πŸ˜„

      Ok. So the idea is to make a Hatchplugin.

      First step is to use sketchup tools and make a face. Wall, rectangle whatever. Select it and run the plugin
      with a simple promt.

      In general getting input from user about desired line_angle and distance between them.
      Make the lines and some sort of grouping before intersect_with method.
      Wich hopefully will give the result of hatched lines.

      So by using boundingbox One can use the plugin on unregular faces, not just squares.
      I wish then to copy lines across the diagonal in the boundingbox, making sure I get edges in the corners.
      Why boundingbox? For ex. If I have an edge that is 45 degrees com to X , copying that line from center in an array straight up in Z until it reaches the boundingbox will leave the corners uncovered.

      Maybe if I new how many copies to clear the boundingbox with the last copy of edge that may be an easier
      method. But that all depend on how the boundingbox is shaped?
      Same goes for copying along the diagonal.
      You may be right, there might be some easier method of doing this. But I'm no math expert and struggling here
      understanding what I just did.
      Help would be very welcomed, and mentioned if I get this to work πŸ˜„

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      YEY! That works!

      I dont know if it will matter if the vector gets shortened, just yet.
      Was thinking of grouping the result. Make an duplicate. Scale -1 in vector and do an intersect with.
      You probably figured out already what this plugin will do.

      Thank you TIG!

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      @unknownuser said:

      I used the term 'container' to refer to the generic 'entities container'...

      I suspected it was something like that you meant. I'm so new on this so I dont grasp the "talk"
      donte walk the walk etither πŸ˜„

      @unknownuser said:

      Do you want the translation vector to have a length of: "user_length = 20" ?

      Hi Kyyu. I want to have multiple copies in vector direction. User-length is the amount of distance
      between copies. In this case 20.

      I should have documented my code better. Its difficult to understand want I am trying to do.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      I couldent find any "container" in the API. Does that mean boundingbox or entity-container perhaps?

      Anyway i figured out a way through the API to get what I want. Just need to copy the lines on the
      vectors direction. pt1 and pt6. Further down is noted where I have problems.
      I will have to make an ekvation based on user_input "distance between lines" and how many times to copy to
      clear(pass by) pt 6. Any thoughts?

      Code is very unfinished I guess.

      mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
      
      face_group = ent.add_group(sel)
      Sketchup.active_model.selection.add( face_group )
      
      bbox = face_group.bounds
      
      bpt1 = bbox.corner(0)
      bpt2 = bbox.corner(1)
      bpt3 = bbox.corner(2)
      bpt4 = bbox.corner(3)
      bpt5 = bbox.corner(4)
      bpt6 = bbox.corner(5)
      bpt7 = bbox.corner(6)
      bpt8 = bbox.corner(7)
      
      pt1 =bpt1
      pt2 =bpt2
      pt3 =bpt3
      pt4 =bpt4
      pt5 =bpt5
      pt6 =bpt6
      pt7 =bpt7
      pt8 =bpt8
      x_cen = bbox.center
      
      x_vect = pt1.vector_to pt4
      diag_vect = pt1.vector_to pt6
      x_ang = x_vect.angle_between(diag_vect).radians
      user_input = 30   # will get shorter alias
      user_length = 20 # will get shorter alias
      
      
      h_group =ent.add_group()
      line_group=ent.add_group() ###==new empty group
      line_group.entities.add_line(pt1, pt6)
      tr1 = Geom;;Transformation.rotation x_cen, [0,1,0],(x_ang).degrees
      tr2 = Geom;;Transformation.rotation x_cen, [0,1,0],(user_input).degrees
      #tr3 = Geom;;Transformation.translation pt4
      ent.transform_entities tr1, (line_group)
      ent.transform_entities tr2, (line_group)
      #ent.transform_entities tr3, (line_group)
         
          
      vector=diag_vect
      gp=line_group
      groups=[gp]
      15.times{|i|
      tgp=gp.copy
      # code below does not work. Wanto translate in vector * 20(user_length) 
      tgp.transform!(Geom;;Transformation.translation(vector)*(user_length))
      gp=tgp
      groups << gp
      } 
         
      
      
      
      
      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      This is great help. πŸ‘
      The ruby API examples are a little difficult to understand. Now I have something new to work on!

      Thank you TIG!

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Get rotation(transformation)

      Hmm Maybe this?
      http://forums.sketchucation.com/viewtopic.php?f=180&t=35018&p=310308&hilit=edge+angles+on+rectangle#p310308

      Maybe TIG's comparison. vec1.angle_between(vec2) ?

      Something like vec1 = pt1, pt3 and vec2 = pt1, pt4? (simply put)

      posted in Developers' Forum
      jolranJ
      jolran
    • 1 / 1