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

    ziocleto

    @ziocleto

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

    ziocleto Unfollow Follow
    registered-users

    Latest posts made by ziocleto

    • RE: Adding two Point3d, is that impossible?

      Yes we do agree that not having a Point3d+.(Point3d) is 99% just sloppiness, which I can fully understand.
      I've worked on some big code projects in my days and yes, eventually even if you have a team of gurus some sloppiness is un-avoidable, for all sort of reasons.

      I would like to discuss the more general language side of the matter (the whole API architecture) but I don't think I'll ever have time to spend on it! πŸ˜‰

      posted in Developers' Forum
      Z
      ziocleto
    • RE: Adding two Point3d, is that impossible?

      @slbaumgartner said:

      While agreeing that it seems strange that the SketchUp developers have never addressed this question, I would quibble that adding points is not clearly more obvious. It depends on what you are trying to do. If you are thinking about geometric operations, adding two points doesn't make much sense whereas offsetting from a point by adding a vector is essential.

      Well it goes against 99.99% of what any other graphics engines or math classes do.
      Adding 2 points it's pretty basic stuff in any math related algorithm, via all sort of architectures, CPUs, GPUs, abacus, you name it πŸ˜‰

      The strong typization of Point3d and Vector3d is also very questionable as normally having the same memory footprint and data behaviour those 2 types pretty much means the same thing from an algorithm point of view, in fact they are heavily parallelized in any architecture to achieve better performances.

      A Vector3d is a Point3d basically, but you can have different functions to perform vector-like operation (normally a normalised direction), but having 2 classes instead of a different set of functions is weird... very...

      posted in Developers' Forum
      Z
      ziocleto
    • RE: Adding two Point3d, is that impossible?

      Thanks, that confirms my fears. 😞

      Yes I can do all sort of workarounds but as a language geek sort of person I fail to understand how you would prefer to implement Point3d.+(Vector3d) or Point3d.+(Array) and not the clearly more obvious: Point3d.+(Point3d)

      I can only think it's one of those bugs somebody put in there in the first place and that's created a massive headache or negligence for people to fix it...

      posted in Developers' Forum
      Z
      ziocleto
    • Adding two Point3d, is that impossible?

      Hi,

      this seems an absurd question and goes beyond any common sense but here it is, how do I add two Point3d?
      Something like this:

      a = Geom::Point3d.new(1,1,1) b = Geom::Point3d.new(0,1,1) c = a + b

      Now this spits out a Error: #<ArgumentError: Cannot convert argument to Sketchup::Vector3d>
      Which would seems like that it's only possible to add a Vector3d to a point3d, which is pretty nonsense to me.

      Sketchup documentation says there's a Point3d.+ operator with Point3d as arguments, but then fails to report a snippet with an actual point3 + point3d, which adds to my confusion:

      *Point3d.+SketchUp 6.0+
      The '+' operator is a fast way to add to the current x, y and z values of a point, or to set the values of a point by adding to other points together.

      **Arguments:

      point2
      A Point3d object.**
      Returns:

      point
      a Point3d object
      pt2 = pt + vec
      pt = pt + [10,10,10]*

      posted in Developers' Forum
      Z
      ziocleto
    • Best practice for followme

      Hi,

      I have a nicely created geometry using the followme function, something like this:

      status = myFace.followme(lines)

      status is ok and everyone is happy, but what's the best practice for selecting the faces/entity just created by the followme function, in this instance I'd like to move it somewhere else.

      Cheers

      posted in Developers' Forum
      Z
      ziocleto
    • RE: Using add_line to automatically create a new face

      Thanks I've missed that edge.find_faces, it works great.
      I think the naming put me off as I wasn't expecting that it will also add faces, I just thought it was going to find potential faces, I think it should may be renamed: find_and_add_faces just for clarity.

      posted in Developers' Forum
      Z
      ziocleto
    • RE: Using add_line to automatically create a new face

      Sorry it looks like it's all working fine now.
      I'm not quite sure what triggered it work maybe quitting sketchup and reloading it after a long session fixed it.

      posted in Developers' Forum
      Z
      ziocleto
    • RE: Using add_line to automatically create a new face

      Hi TIG,

      I've tried entities.add_face(args), which is how I create geometry normally. But the problem I have is more subtle.
      It's the different behaviour between adding a line in sketchup (UI from mouse) and adding the same line from API call.

      If I draw the same line with the same points in sketchup (UI from mouse) on that particular piece of geometry it adds automatically a face (polygon), which is the intended result and it's correct.

      If I call entities.add_face(edge) from ruby API either I get an error (too few parameters, at least 3 edges) or if I use entities.add_line(pointA, pointB) or entities.add_edge(pointA, pointB) it draws a line/edge but fails to create the face (polygon), which is not the same behaviour that I have if I do it manually with the mouse.

      So is there a soft of global function to set to automagically create faces in those circumstances form API?

      posted in Developers' Forum
      Z
      ziocleto
    • Using add_line to automatically create a new face

      Hi all,

      first message here, nice to meet you all. I'm a newbie with sketchup but ok at programming.
      Now my question is:

      let's say I have built a piece of geometry, which is beautiful,

      From Sketchup UI:
      Adding just 1 line (from point A to point B) skectchup auto-generates a new polygon.

      From Ruby script API:
      Using the same points A,B and using entities.add_line ... or add_edges etc there is indeed a line appearing in the model but it doesn't auto-generate the polygon.

      How can I auto-generate a polygon from the same configuration in the Ruby API?

      Cheers

      posted in Developers' Forum
      Z
      ziocleto