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.
Forum topic · Scripts Wanted
Export positions at multiple frames
By cuatcside · 2013-02-20
Description
Comments (8)
cuatcside · 2013-02-21
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 · 2013-02-21
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
:)
Anubis · 2013-02-21
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.
here is the base
Anubis · 2013-02-21
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
cuatcside · 2013-02-21
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 · 2013-02-21
Your path are wrong
myFile = GetDir #export + "\\1.dwg"
--or
myFile = GetDir #export + "/1.dwg"
cuatcside · 2013-02-21
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 · 2013-02-21
Change the line
for f in frm do at time f ( ... }