Export positions at multiple frames

I was wondering if somebody can help me with a script I need.
I have a simple object in max with a motion. I need to export that box at certain frames as one dwg file. (lets say frames 50 53 89 100) so when I open the dwg file in cad I can see four boxes which their positions are based on frames 50 53 89 and 100 in max.
Thanks.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cuatcside's picture

It worked for the 3d

It worked for the 3d object.Thanks a lot. If I want to have it to work with a 3d spline as well do I need to make any changes?
Thanks again

barigazy's picture

I hope that Panayon not mind

I hope that Panayon not mind if i use his code

obj = selection[1]
frm = #(50, 53, 89, 100)
max select none
 
for f in frm do at time f do 
(
  if isKindOf obj GeometryClass and not isKindOf obj TargetObject then 
  (
	  snapshot obj
	  selectMore objects[objects.count]
  ) else select obj
)
 
myFile = GetDir #export + "/my_name.dwg"
exportFile myFile #noPrompt selectedOnly:on

bga

Anubis's picture

:)

I miss "do" :) thanks for testing my code.
Here is a bit of modification:

obj = selection[1]
frm = #(50, 53, 89, 100)
 
if IsValidNode obj and \
canConvertTo obj Editable_Mesh then
(
  max select none
 
  for f in frm do at time f do 
  (
    snapshot obj
    selectMore objects[objects.count]
  )
 
  myFile = GetDir #export + "/my_name.dwg"
  exportFile myFile #noPrompt selectedOnly:on
)
else messageBox "Select a geometry or shape"

This way s'd be able to work on shapes as well.

my recent MAXScripts RSS (archive here)

Anubis's picture

here is the base

obj = selection[1]
frm = #(50, 53, 89, 100)
max select none
 
for f in frm at time f do (
  snapshot obj
  selectMore objects[objects.count]
)
 
myFile = GetDir #export + "/my_name.dwg"
exportFile myFile #noPrompt selectedOnly:on
-- delete selection

my recent MAXScripts RSS (archive here)

cuatcside's picture

Thanks for your help. I

Thanks for your help.
I copied your code to maxscrip editor and changed your myFile line to myFile = GetDir #export + "c:\1.dwg" and ran it, got this error.
Do I need to make any changes to script beside myFile =...

obj = selection[1]
frm = #(50, 53, 89, 100)
max select none

for f in frm at time f do (
snapshot obj
selectMore objects[objects.count]
)

myFile = GetDir #export + "c:\1.dwg"
exportFile myFile #noPrompt selectedOnly:on

-- Error occurred in anonymous codeblock; filename: C:\Users\ali\AppData\Local\Autodesk\3dsMax\2012 - 64bit\enu\UI\usermacros\; position: 82; line: 5
-- Syntax error: at at, expected "do" or "collect"
-- In line: for f in frm at t

Thanks again for your help.

barigazy's picture

Your path are wrong

Your path are wrong

myFile = GetDir #export + "\\1.dwg"
--or
myFile = GetDir #export + "/1.dwg"

bga

cuatcside's picture

changed the path, and still

changed the path, and still getting error:

-- Error occurred in anonymous codeblock; filename: C:\Users\ali\AppData\Local\Autodesk\3dsMax\2012 - 64bit\enu\UI\usermacros\; position: 82; line: 5
-- Syntax error: at at, expected "do" or "collect"
-- In line: for f in frm at t

barigazy's picture

Change the line for f in

Change the line

for f in frm do at time f ( ... }

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.