Operating on multiple parts


Operating on multiple parts
#1
Is it possible to apply the same rotations on more than one part at the same time? E.g. rotate each part around the y axis by 90 degrees for instance, but not around a common center but around each part locally. Can this be done in MLCAD?
Reply
RE: Operating on multiple parts
#2
Maybe you should go to LDDP Homepage. This app in dedicated for mathematical operation on LDraw models too.
Lego isn't just a brand of plastic bricks. It's a lifestyle; and artistic medium.
Reply
RE: Operating on multiple parts
#3
(2017-12-27, 11:07)Jarema Wrote: Maybe you should go to LDDP Homepage. This app in dedicated for mathematical operation on LDraw models too.

Thanks. I was actually thinking that this might be easier by editing the source files by hand, and LDDP seems designed for that.
Reply
RE: Operating on multiple parts
#4
(2017-12-27, 2:38)Michael Horvath Wrote: Is it possible to apply the same rotations on more than one part at the same time? E.g. rotate each part around the y axis by 90 degrees for instance, but not around a common center but around each part locally. Can this be done in MLCAD?

You can do this in my LDCad if you not afraid of an adventure in scripting.

edit: using this script:
Code:
function onRotInsRun()
 local sf=ldc.subfile()
 
 if sf:isLinked() then
   local sel=ldc.session():getSelection()

   local ori=ldc.matrix()
   ori:setRotate(45,0,1,0)

   for i=1,sel:getRefCount() do
     local ref=sel:getRef(i)
     ref:setOri(ori)
   end
 end
end

function register()

 local ani=ldc.macro('Rotate instances')
 ani:setEvent('run', 'onRotInsRun')
end

register()
Reply
RE: Operating on multiple parts
#5
(2017-12-27, 18:58)Roland Melkert Wrote:
(2017-12-27, 2:38)Michael Horvath Wrote: Is it possible to apply the same rotations on more than one part at the same time? E.g. rotate each part around the y axis by 90 degrees for instance, but not around a common center but around each part locally. Can this be done in MLCAD?

You can do this in my LDCad if you not afraid of an adventure in scripting.

edit: using this script:
Code:
function onRotInsRun()
 local sf=ldc.subfile()
 
 if sf:isLinked() then
   local sel=ldc.session():getSelection()

   local ori=ldc.matrix()
   ori:setRotate(45,0,1,0)

   for i=1,sel:getRefCount() do
     local ref=sel:getRef(i)
     ref:setOri(ori)
   end
 end
end

function register()

 local ani=ldc.macro('Rotate instances')
 ani:setEvent('run', 'onRotInsRun')
end

register()

Can I select the objects to operate upon using the mouse? That would save a lot of time.
Reply
RE: Operating on multiple parts
#6
(2017-12-27, 21:47)Michael Horvath Wrote: Can I select the objects to operate upon using the mouse? That would save a lot of time.

Yes it uses the active selection and applies the 45 deg rotation matrix to them all.

I've reworked the macro to apply the rotation of the first item in a selection (the one clicked first) to all the other items in the selection.

As this is a handy thing to have I added it to the samples module for the next version, but you can easilly use it now by replacing %appdata%\LDCad\scripts\default\global\samples.lua by the one in the attached zip file

You can use it on any selection through "scripts/samples/copy orientation" menu when installed.

ps: I'm assuming you're using the latest 1.6 version and not the older one from the AIOI. If so you can upgrade by running the 1.6a setup.


Attached Files
.zip   samples.zip (Size: 2.35 KB / Downloads: 0)
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)
Forum Jump:


Users browsing this thread: 1 Guest(s)