LDCad 1.6a (win+linux)


RE: LDCad 1.6a (win+linux)
#28
PHP Code:
--Local functions
local 
function get_index (tabval)
    for 
indexvalue in ipairs(tab) do
        if 
value == val then
            
return index
        end
    end

    
return nil
end 

PHP Code:
--Database
axle_normal_desc 
= {
      'Technic, Axle 2','Technic, Axle 3'
     ,'Technic, Axle 4','Technic, Axle 5'
     ,'Technic, Axle 6','Technic, Axle 7'
     ,'Technic, Axle 8','Technic, Axle 9'
     ,'Technic, Axle 10','Technic, Axle 11'
     ,'Technic, Axle 12','Technic, Axle 16'
     ,'Technic, Axle 32'
}
axle_normal_num = {'3704.dat','4519.dat','3705.dat','32073.dat','3706.dat','44294.dat'
                    ,'3707.dat','60485.dat','3737.dat','23948.dat','3708.dat','50451.dat','50450.dat'}


function 
runReplaceAxleHelper()
  --Some dummy proof tests.
  local ses=ldc.session()
  if not ses:isLinked() then
    ldc
.dialog.runMessage('No active model.')
    return
  end
  
--Selected session
  local sel
=ses:getSelection()
  local cnt=sel:getRefCount()
  if cnt>0 then
      
--use the first item as base
      local curPart 
sel:getRef(1)
      local curIdentget_index(axle_normal_num ,curPart:getName())
      local curOricurPart:getOri()
              
curOri:setPos(curPart:getPos())
      --Some dummy proof tests.
      if curIdent == nil then
       ldc
.dialog.runMessage('The wrong item was chosen')
       return
      end
      
--Let the user pick the new axle.
      local part=ldc.dialog.runChoice('Select a new axle'axle_normal_desccurIdent)
      if axle_normal_num[part] == nil then
      
else
        sel:getRef(1):delete()
        sel:remove()
        sel:add(ldc.subfile():addNewRef(axle_normal_num[part], 4curOri))
      end
  end
end 

This is example code for functionality i propose to be part of incoming release.
Lego isn't just a brand of plastic bricks. It's a lifestyle; and artistic medium.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
LDCad 1.6a (win+linux) - by Roland Melkert - 2017-10-01, 19:45
RE: LDCad 1.6a (win+linux) - by Jarema - 2018-03-10, 19:31
RE: LDCad 1.6a (win+linux) - by Jarema - 2018-03-11, 8:09
RE: LDCad 1.6a (win+linux) - by Jarema - 2018-03-11, 11:54
RE: LDCad 1.6a (win+linux) - by Jarema - 2018-03-12, 7:07
RE: LDCad 1.6a (win+linux) - by Jarema - 2018-03-12, 17:35
RE: LDCad 1.6a (win+linux) - by Jarema - 2018-03-13, 7:24

Forum Jump:


Users browsing this thread: 1 Guest(s)