LDCad 1.6 suggestions/plans


Re: LDCad 1.6 macro scripting
#89
Hello all,

I've been thinking about the macro scripting feature to be added in 1.6.

This made me wonder about what people might want to do with those macro's as that determines the api extensions needed.

I've been thinking about adding:
  • Simple dialogs (input str/number, message, confirm)
  • Camera control (e.g. use a macro to set a specific camera view)
  • Selection control (e.g. use a macro to align bricks or apply some auto placement math).

Is anyone has some additional ideas of things to do with macros and what would be needed in order to get it working from the lua environment.

Example of a (almost mandatory) hello world maco:

Code:
--[[
  LDCad macro scripting example

  This script demonstrates how to add a simple macro to the GUI.
--]]


function register()

  --Register a new macro named 'Hello'
  -- This new macro will show up in this script's dedicated submenu within the 'Scripts' menu.
  local macro=ldc.macro('Hello')

  --Set the optional hint for this macro item.
  macro:setHint('Very simple macro example.')

  --Link the macro to the lua function to be called when the user clicks it in a menu.
  macro:setEvent('run', 'onRunHello')
end

function onRunHello()
  --This function will be called when the user clicks the 'Hello' macro in a menu.
  -- So lets perform its groundbreaking task.
  ldc.dialog.runMessage('Hello, welcome to '..ldc.getVersion()..' running lua '..ldc.getLuaVersion())
end

--Call the main register function.
-- It is best to register things in a dedicated function in order to minimize global variables.
register()
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: LDCad 1.6 macro scripting - by Roland Melkert - 2016-01-27, 23:00
Re: LDCad 1.6 ROTSTEP feedback - by TestOne - 2016-02-25, 22:56
RE: LDCad 1.6 suggestions/plans - by Kai - 2016-05-23, 18:48
RE: LDCad 1.6 suggestions/plans - by Art - 2016-08-11, 12:56
RE: LDCad 1.6 suggestions/plans - by Art - 2016-08-12, 7:29
RE: LDCad 1.6 suggestions/plans - by Karen M - 2017-10-24, 10:28

Forum Jump:


Users browsing this thread: 2 Guest(s)