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
    • RE: Draw parallel line, distance=11

      @unknownuser said:

      Aha, you mislead us somewhat by not stating your real question at first!

      Indeed.

      I think Slbaumgartner wraps it up pretty nicely.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Draw parallel line, distance=11

      A, what the heck. Here some very simple code suggestion. I don't know if it's this you want to do.

      Sure this can be implemented by math calculations. But using vectors and points + maybe adding length.class assures you'll be within Sketchup tolerance..
      I'll probably do different if communicating with exterior program. But always convert to Point3d objects.

      prompts = ["length", "Run","height","Rise","Total Rises"]
       defaults = [36.0,10.0,1.0,7.75,7]
       input = UI.inputbox prompts, defaults, "Tread."
       
       
       len, run, heit, rise, n_steps = input #len(a) not used in original ?
       ent = Sketchup.active_model.entities
       
       # Assuming height is meant startdistance under ORIGIN
      pts = []
      
      v_rise = Geom;;Vector3d.new(0,0,rise)
      v_run = Geom;;Vector3d.new(0,run,0)
      startpoint = Geom;;Point3d.new(0,0,-heit).offset!(v_rise.reverse)
      p1 = startpoint.offset(v_run)
      
      pts << p1
      pts << startpoint
      
      for i in (0...n_steps)
      
      	pts << startpoint = startpoint.offset(v_rise)
      	pts << startpoint = startpoint.offset(v_run)
      	
      end
      
      pts << startpoint.offset(v_rise.reverse)
      
      f = ent.add_face(pts)
      f.pushpull(20)
      
      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Draw parallel line, distance=11

      I don't have time for code, but I drew this quick idea..
      Shouldent be to difficult to figure out vectors and loop points..
      Be careful doing mathcalculations to use Point3d ojects so the floats don't hose you out of sketchup tolerance..


      stairs.jpg

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Draw parallel line, distance=11

      Ah, doh. I missread. You want an edge, not an infinite line.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Draw parallel line, distance=11

      Do you really need to edit both z-values? I thought the vector was static in the equation..
      I'm confused ๐Ÿ˜• Try different y values on pt and test if the line is not straight..

      mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
      
      a = -50
      b = [[0,0,a],[0,50,0]]
      pt = Geom;;Point3d.new(10,999,0)
      
      pt2 = pt.project_to_line(b)
      ent.add_cpoint(pt2)
      
      
      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Draw parallel line, distance=11

      Below ? In Z-axis you mean.

      Well the first value is a point so maybe try [[0,0,-dist], [0,30,40]]

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Change variable after certain number of loops

      @unknownuser said:

      Thanks,
      I'm just trying to find a way not to have to keep pressing 'Ctrl & "A" then delete, every time I want to test a code.

      Ah, right! Understood.

      Well TT and Driven got the answers already.

      Another handy plugin is using Alex Ruby-code editor.
      You don't have to wrap code in Start Operation cause there's an inbuilt Play and Undo button. Very useful for testing loose code snippets. Copy and paste from Notepad for ex..

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Change variable after certain number of loops

      One idea is starting using groups to organize your geometry.
      Clearing everything on the screen, sounds like a dangerous approach to me.
      Just a simple tip..

      ents = Sketchup.active_model.entities
      gp = ents.add_group
      ent = gp.entities

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Interstellar movie

      @unknownuser said:

      Not in a long time have I been so excited about a movie

      Me too! ๐ŸŽ‰

      posted in Corner Bar
      jolranJ
      jolran
    • RE: WebDialog particular html issue

      I'm guessing this has to do with lack of meta tags in the HTML head.

      Try something like content="IE=edge" or similar depending on your target.

      You can do a search on META-tag for details, it has been taken up in earlier topics.

      Or here:

      https://github.com/thomthom/sketchup-webdialogs-the-lost-manual/wiki/Doctype---Quirks-vs-Standard-vs-Superstandard

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: The Dutch are a sensible people!

      Anything that kills "weed" is determined to get banned in the Netherlands. ๐Ÿ˜Ž

      posted in Corner Bar
      jolranJ
      jolran
    • RE: SketchUp and virtual reality modeling

      Try to do that for 8 hours a day for 2 months and see what kind of tendonitis gets developed... ๐Ÿ˜„

      posted in SketchUp Discussions
      jolranJ
      jolran
    • RE: Quicker architectural modeling + construction documentation

      Not sure if this will be of any help, 2dboolean.
      (It's free so you can have a look at no expense, and see if it's useful)
      http://sketchucation.com/forums/viewtopic.php?p=350557#p350557

      Could be used not only for fitting 2d components to a face, but also in the creation of extruded sheet metals for walls etc. Or any other pattern you can come up with.

      (manual is on same page)

      posted in Extensions & Applications Discussions
      jolranJ
      jolran
    • RE: Error creating groups and components

      I get the same behavior as you, with your file.
      Cannot reproduce it by creating my own project.
      Funny thing, if you explode and regroup, the behavior continues.

      If you explore the nested affected group it has Parent: #Sketchup::ComponentDefinition:0xfa0aba4

      The parent group's Parent = #Sketchup::Model:0xb4c150c

      So there appears to be some hiearchy problems perhaps, unless I'm reading the
      values wrong.

      Have you copied and pasted in a group into the parent group, per chance ?

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Testing Ruby VALUES in C-extension.

      @unknownuser said:

      I can't speak for WXwidgets, not familiar with it. Though I seem to recall some issues where they changed the order the window hierarchy - but maybe that was just the Ruby wrapper, I don't know.

      I think it was the Ruby wrapper that was causing problems.
      The posts touching the subjects are very old, as mentioned..

      @unknownuser said:

      But in general you can use whatever C/C++ lib you want. Native dialogs, knock yourself out. ๐Ÿ˜„ I haven't done so myself yet, but I wanted to try out a simple hello world window once.
      I have done some code that calls the system folder picking dialogs though. Works very well.

      โ˜€ I thought it was a no go on that! I'll peek around a little then.
      Report back if I find something exiting.

      Thanks

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Testing Ruby VALUES in C-extension.

      @unknownuser said:

      That's a Ruby world optimization - because creating Ruby objects are expensive.
      Not the same in C++.

      Ok understood. It's quite wierd comming from Ruby to C++.

      @unknownuser said:

      So now you're getting the correct array size?

      Yes. And the code work's as I wanted to ๐Ÿ˜„ So far anyway. Really fast.
      I included your MACRO just to be safe. The code worked compiled in SU8.

      I imagine I could even make it faster refactoring it. But.. Most importantly I want it to be proper, so I try to follow your advice and read up on best practices before I move on.

      On another different subject while we are at it. Probably should start a new topic, but it doesent fell improper to ask here as well.

      Can we use Windows forms or WXwidgets(not WX-rubyversion) or other GUI toolkit with c++ in Sketchup ?
      I've seen discussion about it, but it was long time ago and relevant to only Ruby.

      I've seen examples where they hook up MFC as resource to win32 projects. Also read here somewhere it can be problematic to hook that up to Sketchup window, since windialogs are under the desktop(?)
      Anyway, not an substitute for webdialogs, just could be handy for some simpler dialogs using visual studio dialog editor.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Testing Ruby VALUES in C-extension.

      Well well. How dumb can one get seriously ๐Ÿ‘Š

      Have been copying and pasting in code from Notepad++ to sketchup ruby code editor.
      Totally unfocused on that part..
      At some point I must have pushed ctrl v instead of ctrl c, so I not noingly had duplicate code. ๐Ÿ˜ก

      Off course I wasent editing the first part that was sent in to Visual studio for step over.

      Hehum, thanks for the help Thomthom. All is not lost. You have provided some good information for the rest of us and I learned some new stuff ๐Ÿ’š

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Testing Ruby VALUES in C-extension.

      I meant hoisting variables before running loops. Speeding up the loops by not declaring them inside the loop.

      Changing to rb_funcall(curve, rb_intern("get_points"), 0); made no difference, so I will try that other macro you mentioned. Otherwise there must be some hole in my logic elsewhere..

      PS: I havent come to best practices part yet ๐Ÿ˜„

      Thanks for the help.

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Testing Ruby VALUES in C-extension.

      I am doing a C++ extension, yes.

      @unknownuser said:

      rb_intern returns ID, not VALUE

      ๐Ÿ˜ฎ Well that changes things. That could be it. Will test that in various combinations and report back.

      So would the syntaxrb_funcall(rb_intern("get_points")etc... be better then instead of storing it ?

      @unknownuser said:

      try to reproduce in a small standalone case.

      I have created a smallish testcase. Although I needed some classes for that.
      So the code become over 500 lines.
      I run that code in Alex ruby code editor while debug. Don't know if that can affect the scope of class or anything.

      And I have tested the data before sending in to c-extension, it's alright in Ruby.

      The C++ code may very well have logic errors I havent found yet. So I have to scan that through again. It looks like this is the main problem though, since I'm dependent of array length for next iterations. When all the arrays(curves) have same length code is working.

      @unknownuser said:

      That's very old C syntax. Even newer C syntax allow you to declare variables when you need them.

      I couldent tell whats proper syntax or not, yet. That does sound easier.
      Does that go for loops/iterators as well?

      posted in Developers' Forum
      jolranJ
      jolran
    • RE: Testing Ruby VALUES in C-extension.

      Ahhh. A solution perhaps ๐Ÿ˜„
      I'm running Sketchup 2013 in debug mode. So it should be running Ruby 1.8.6 though ?

      This has been a very annoying problem to solve. I'm clueless.

      There's no error but irratic behavior with wrong values which makes it hard to track.

      I was thinking it had something to do with me calling instance method from a class
      sort of thing. The "curve" is an instance from a class I created and not a Sketchup curve, but I assume you got that part.

      I suppose I could make the Ruby array an accessor and then use instance var get, but I rather not.

      Will try your code when I get to my workstation later.

      Thanks!

      posted in Developers' Forum
      jolranJ
      jolran
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 51
    • 52
    • 5 / 52