sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    DC confusion... help needed

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    3 Posts 2 Posters 1.1k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Sheik
      last edited by

      I am trying to learn how to make a Dynamic Component, but I am stuck…
      My problem is a bit hard to explain, but bare with me.
      I am making a configurable spotlight for MaxwellRender. You can turn it, and adjust the reflecting parabola to get different angles for the spotlight. Just the rotation would have been easy, but combining the scaling of the parabola and rotating so that it stays correctly positioned became a problem because the center of rotation is outside the parabola component, so I had to brush up my very vague memories of trigonometry to define the position of the scaled and rotated component. Probably already lost you there didn’t I…
      Now to my actual question:
      I can make the trigonometric formulas work, but when entering the angle zero degrees the formula is incorrect, because I get a division by zero. (It works fine with all other angles). How do I awoid this?

      I made an attempt to explain myself on a picture in the skippy. Try setting the FrontRotate value to zero, and look at the X position attribute of the Mirror child component.
      Well, if I didn’t loose you yet then you are a smart one ☀ .
      ☀


      spotlight_Tan_problem.skp

      1 Reply Last reply Reply Quote 0
      • M Offline
        matthew.robert
        last edited by

        I have ran into similar things. Do you know what the value of w should be when the error occurs? Does w=zero if TAN(A/2)=zero? If I remember right, even if there is a division by zero in a conditional statement... it still results in an error even if that "condition" value is not returned.

        Could you do something like...

        A= [whatever]
        aPass= IF(A=0,1000,CURRENT("A"))
        w= h/tan(aPass/2)

        Maybe not the ideal example, but I am thinking if the aPass condition is met where A=0, you could plug in some outlier value that could then later be flagged... like:

        RealW= IF(w=[outlier value],0,current("w")

        I am not a math whiz, but I do know how to make the "cents" sign and this is my 2¢

        MC

        1 Reply Last reply Reply Quote 0
        • S Offline
          Sheik
          last edited by

          Thanks Matthew,
          I'll try that. The value should be zero at zero, so this should be easy.
          Sheik

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement