Thinking about doing a LDCad 1.7 version


RE: Thinking about doing a LDCad 1.7 version
(2020-05-05, 22:07)Roland Melkert Wrote: I realized if you assume all selection points are on a plane, you can drop the setX/setY lines and calculate the plane normal instead of using a static x vector

Code:
function onRun()   local sel=ldc.selection()   if sel:getRefCount()<3 then     return   end   local a=sel:getRef(1):getPos()   local b=sel:getRef(2):getPos()   local c=sel:getRef(3):getPos()   local ba=a-b   local bc=c-b   local n=bc:getCross(ba)   n:normalize()   local bb1=n:getSignedAngle(ba, bc)   local bb2=math.deg(math.acos(bc:getLength()/ba:getLength()))   local angle=-(bb1-bb2)   ldc.setClipboardText(angle)   ldc.dialog.runMessage(angle) end

neg y makes it somewhat confusing but i think this should work in any orientation, not tested though.

This version got me close, but not quite:
   
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Thinking about doing a LDCad 1.7 version - by N. W. Perry - 2020-05-06, 3:14

Forum Jump:


Users browsing this thread: 1 Guest(s)