Thinking about doing a LDCad 1.7 version


RE: Thinking about doing a LDCad 1.7 version
(2020-05-05, 19:44)N. W. Perry Wrote: Yep, I think so too. Like I said, the perfect starter project if I find myself with no other plates spinning.  Smile
It's a fairly simple one if you assume it's on the abs yz plane

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()

  a:setX(0)
  b:setX(0)
  c:setX(0)
  c:setY(b:getY())

  local ab=a:getLength(b)
  local bc=b:getLength(c)

  local bb1=ldc.vector(1,0,0):getSignedAngle(a-b, c-b)
  local bb2=math.deg(math.acos(bc/ab))

  local angle=-(bb1-bb2)
  ldc.setClipboardText(angle)

  ldc.dialog.runMessage(angle)
end

function register()

  local macro=ldc.macro('My macro')
  macro:setEvent('run', 'onRun')
end

register()

Could use some more cleanups and dummy proof checks though

It gave me the idea to add access to the relative grid in 1.7, so thanks for that
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Thinking about doing a LDCad 1.7 version - by Roland Melkert - 2020-05-05, 20:54

Forum Jump:


Users browsing this thread: 6 Guest(s)