The Area http://area.autodesk.com/forum/ The Area en Copyright 2010 2010-03-20T02:49:05+01:00 SimpleObject - Geometry from Text Shape http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/simpleobject---geometry-from-text-shape/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/simpleobject---geometry-from-text-shape/page-last/#When:12:56:16Z Hi! I am trying to create a SimpleObject that should get the basic mesh from a Text spline. Here is sample code: [code] plugin simpleObject ObjFromTextShape_plugin_def name:"ObjFromTextShape" classID:#(145348,543218) category:"Scripted Primitives" ( parameters ParamOFTS rollout:RollOutOFTS ( OFTSheight type:#worldUnits ui:OFTSheight default:0 animatable:true OFTSwidth type:#worldUnits ui:OFTSwidth default:0 animatable:true OFTSdepth type:#worldUnits ui:OFTSdepth default:0 animatable:true ) rollout RollOutOFTS "Main Parameters" ( spinner OFTSheight "Height" type:#worldunits range:[-1000,1000,0] spinner OFTSwidth "Width" type:#worldunits range:[-1000,1000,0] spinner OFTSdepth "Depth" type:#worldunits range:[-1000,1000,0] ) on buildMesh do ( local txtObj if (txtObj == undefined) do ( txtObj = createInstance text -- txtObj = text text:"Test" txtObj.text = "Test" -- txtObj.name = "textObj" txtObj.font = "Arial" ) convertto txtObj TriMeshGeometry mesh = txtObj.mesh ) tool create ( on mousePoint click do ( case click of ( 1: nodeTM.translation = gridPoint 3: #stop ) ) on mouseMove click do ( case click of ( 2: (OFTSwidth = gridDist.x; OFTSdepth = gridDist.y) 3: OFTSheight = gridDist.z ) ) ) ) [/code] The problem I can't work around is that I can't use my Text object the way I want to. The sample code results in error: No ""convertTo"" function for Text << I think that is because I have created an instance of the Text class instead of a Text object itself. Creating a Text object will result in other strange behaviour where my Parameters gets unavailable and causes Max crashes. Error: Couldn't find a previously defined paramblock in ObjFromTextShape_plugin_def That seems not to happen in this example code, but crashes any larger size code I have tested, the convertto command seems to mess with SimpleObject parameter blocks Is there any way to from inside a SimpleObject, create, convert and fetch the mesh from a Text shape? 2010-03-20T12:56:16+01:00 Asset Tracking http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/asset-tracking/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/asset-tracking/page-last/#When:13:44:54Z Hi, I'm currently investigating the asset tracking functionalities with perforce. So far I’m able to control some aspect of it but I lost the prompt for open for edit and now the asset tracking automatically open my files for edit. I still like to have the prompts does any of you guys know where I can control these behaviors ? Best, 2010-03-19T13:44:54+01:00 DotNet Checkboxes in ListView http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/dotnet-checkboxes-in-listview/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/dotnet-checkboxes-in-listview/page-last/#When:12:30:32Z Hello, how do I add checkboxes to a listview? If found several docs in the web for dotnet generally, but my script doesn't work. Can anybody help me and give me a hint? Thank You! Regards, Chris [code]global roDotNetTestDialog global iEntryIndex = 0 fn fnInitDotNetView dncFileView = ( dncFileView.gridLines = true dncFileView.fullRowSelect = true dncFileView.MultiSelect = false dncFileView.View = (dotNetClass "System.Windows.Forms.View").Details dncFileView.ShowItemToolTips = true dncFileView.HideSelection = false dnNewColumn = dncFileView.Columns.add ("Column 1") 150 dnNewColumn = dncFileView.Columns.add ("Column 2") 80 dnNewColumn = dncFileView.Columns.add ("Column 3") 150 dncFileView.refresh() ) fn fnAddRow dncFileView sInputText = ( iEntryIndex += 1 dnaFileViewItems = #() dnListItem = dotNetObject "System.Windows.Forms.ListViewItem" ("Entry " + iEntryIndex as string) dnCheckBox = dotNetObject "System.Windows.Forms.CheckBox" dnCheckBox.checked = true dnListItem.SubItems.add dnCheckBox dnListSubItem = dnListItem.SubItems.add sInputText append dnaFileViewItems dnListItem dncFileView.Items.AddRange dnaFileViewItems ) try(destroyDialog roDotNetTestDialog)catch() rollout roDotNetTestDialog "DotNet Test Dialog" ( dotNetControl dncFileView "System.Windows.Forms.ListView" pos:[10,10] width:380 height:180 edittext etInputText "Input" pos:[10,200] width:380 button btnAddText "Add" pos:[175,225] width:50 align:#center on roDotNetTestDialog open do ( fnInitDotNetView roDotNetTestDialog.dncFileView ) on btnAddText pressed do ( fnAddRow roDotNetTestDialog.dncFileView roDotNetTestDialog.etInputText.text ) ) createDialog roDotNetTestDialog 400 260[/code] 2010-03-19T12:30:32+01:00 MaxScirpt ScreenCapture with dotnet http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/maxscirpt-screencapture-with-dotnet/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/maxscirpt-screencapture-with-dotnet/page-last/#When:07:42:59Z [code] Fn ScreenCapture PosX PosY ImgW ImgH ImgFileName = ( try ( local DotNetBmp,DotNetGraphics,DotNetPoint local tempBmp,tempGraphic DotNetBmp = DotNetClass "System.Drawing.Bitmap" DotNetGraphics = DotNetClass "System.Drawing.Graphics" DotNetPoint = DotNetClass "System.Drawing.Point" tempBmp = DotNetObject "System.Drawing.Bitmap" ImgW ImgH tempGraphic = DotNetGraphics.FromImage tempBmp tempGraphic.CopyFromScreen (DotNetObject DotNetPoint PosX PosY) (DotNetObject DotNetPoint 0 0) tempBmp.Size tempBmp.Save ImgFileName tempGraphic.Dispose() true ) catch (false) ) ScreenCapture 0 0 200 200 "c:\testScreenCapture.png" [/code] 2010-03-19T07:42:59+01:00 dotNet - No method found trying to use GetGlyphOutline method on GlyphTypeface class http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/dotnet---no-method-found-trying-to-use-getglyphoutline-method-on-glyphtypeface-class/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/dotnet---no-method-found-trying-to-use-getglyphoutline-method-on-glyphtypeface-class/page-last/#When:07:33:23Z Hi! I am trying to use the dotNet GetGlyphOutline method in GlyphTypeface class from Maxscript. I can't sort out calling the method. Sample code: [code] ( -- loading dotnet assemblies dotnet.loadassembly "PresentationCore" dotnet.loadassembly "WindowsFormsIntegration" dotnet.loadassembly "System" -- classes theClass = dotNetClass "System.Windows.Media.GlyphTypeface" geoClass = dotNetClass "System.Windows.Media.PathGeometry" -- Variable class instances dnChar = dotNetObject "System.UInt16" 4 dnChar32 = dotNetObject "System.Int32" 4 sizeClass1 = dotNetObject "System.Double" 1 sizeClass2 = dotNetObject "System.Double" 1 -- Test font Uri = dotNetObject "System.Uri" "C:WINDOWSFontsTIMES.TTF" -- Test code -- dotNet.showConstructors theClass -- showMethods theClass showStaticOnly:false -- showProperties theClass "*" showStaticOnly:false showMethods:true -- ISupportInit = dotNetClass "System.ComponentModel.ISupportInitialize" -- ISupportObj = dotNetObject ISupportInit -- nonstaticClass = dotNetClass (ISupportInit theClass).BeginInit -- GlyphTypeface instance theObj = dotNetObject theClass Uri -- Retrieve geo geo = theObj.GetGlyphOutline dnChar sizeClass1 sizeClass2 ) -- Runtime error: No method found which matched argument list [/code] Am I doing something wrong or is this error message because of that This API is not CLS-compliant. ? I have checked that only one PresentationCore.dll (version: 3.0.6920.1427) is available in computer under .dotnet framework 3.0 Doing a showMethods on GlyphTypeface, result: [code].[System.Windows.Media.Geometry]GetGlyphOutline [System.UInt16]glyphIndex [System.Double]renderingEmSize [System.Double]hintingEmSize [/code] I am using 3dsmax 9 SP2, Thanks in advance on any advice! 2010-03-19T07:33:23+01:00 applying materials to objects very slow in large scenes http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/applying-materials-to-objects-very-slow-in-large-scenes/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/applying-materials-to-objects-very-slow-in-large-scenes/page-last/#When:23:05:55Z i have an odd issue i'm investigating and i'm hoping some of the experienced maxscript gurus are still watching this forum... we use material toggling heavily in our pipeline in order to create alternate render passes from the same geometry--nothing special there. what has always been a thorn in our side is the time that it takes to run a "obj.material = matX" loop over a few hundred objects in a large scene. in a test scene, even one with a few thousand objects, this loop does not take long at all, but those same objects toggling the same materials will take exponentially longer if in a scene with many other objects, materials, etc. the strange thing is that through the material editor UI, one can assign a material to the same quantity of objects in the same scene almost instantaneously.. why are these two methods so different, and does anyone have any clue how to improve the performance of assigning a material via maxscript? bobo? keith? ...bueller? thanks, greg 2010-03-18T23:05:55+01:00 Cloning objects with an expression controller." Need to increment a variable in the expression when cloned? http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/cloning-objects-with-an-expression-controller-need-to-increment-a-variable-in-the-expression-when-cloned/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/cloning-objects-with-an-expression-controller-need-to-increment-a-variable-in-the-expression-when-cloned/page-last/#When:22:55:56Z I've been looking through the MaxScript reference, and I'm not having much luck with this. I have discovered the best way to animate a moving conveyor-type belt (or tank tracks for example) is to have non-renderable (or hidden) bone objects be moving along a closed path, and the mesh object that is the belt has a skin modifier applied, using those bone objects. It works great and perfect. By using the simple formula for arc length, the "percent along path" for the bones can be made to be dependent on the rotation of the wheels (as long as it's euler xyz), regardless of the shape of the path. You use an expression controller for the "Percent" value, and, using one variable (radius*angle), the path length, and an incremented value in that expression, the whole belt works smoothly just by rotating one of the pulleys. Very slick. But setup time can be "nasty-long" - it's not a big deal if you're setting up one set of tracks. For each track you have x-number of bones (obviously depending on the track length and how smoothly you want the tracks to move). I did this with a model of a Bobcat backhoe on tracks. There were 50 bone objects per track, and setting up one took about 30 minutes - not a big deal. Just cloned the whole setup for the other track. The problem I want to solve is this: I have a model with gears, motors, axels, belts, pulleys, etc. To setup the belts to move with pulleys, you use the same setup - bone objects moving on a path. Each bone's percent is an expression controller, whose expression is this: [(R*A)/L] + N where R = radius of the pulley, A = rotation of the pulley, L = path length, and N = an incremented value for each bone. For the first bone, N = 0, the second N = N + c, where c is some small number, and for the last bone, N is some number less than 1 (since 1 would be 100% along path). It's N that results in the lengthy setup time. For the first belt/pulley setup, N = .005 in order for the belt to move smoothly (has to do with NOT bending it when the belt is straight vs. when it's curving around the pulley. So the first bone has the percent expression: [(R*A)/L] + 0 The next: [(R*A)/L] + .005 The next: [(R*A)/L] + .01 the next: [(R*A)/L] + .015 and so on. Clone a bone, and adjust it's expression accordingly. But you can see why this would take a long time - you have to clone enough bones until you would have the last one before the expression [(R*A)/L] + 1 (which would actually be the first bone again) - 200 to be exact. On top of that, THERES 26 MORE TO DO!!! Ugghh.. It comes down to this: I would think there should be a way, using MaxScript, to clone X number of boxes, all with the same path constraint, but have the expression with N incremented for each (you can figure out what N should be pretty easily). The first bone N = 0, then .005, then .01, etc. N could maybe be related to a frame number, and then you play the animation to create the clones? But how do you create that unique variable N for the respective clone? Obviously, you have something like N=N+.005 in the code somewhere.... but how would it get inserted into the expression box of the "Float Expression" dialog box when the clone is created? You then have your first belt setup. Next, you clone the first box again, and set it on a new path (the next belt), and repeat the process. I would be surprised to find out you couldn't do this with maxscript....or maybe something like this has been made into a plugin? Which I would be happy to purchase if someone has created one. Besides searching the maxscript reference & finding nothing (at least that I can understand), I haven't found any plugins that seem like they could do this. All the cloning plugins I've seen allow for complex cloning, but they only use parametric values for orientation/position etc. You could figure out how to distribute the clones so they match the shape of the belt, but the key is that they need that incremented percent expression. Any ideas? If you think maxscript can do this, I'll certainly try it - but I'm not sure where to start. Basically, maxscript is taking the place of using the mouse to select an object, cloning it, and then adjusting it's expression controller. But it has to do it X times, where X = 1/N, and N = the smallest distance (in percent) between two adjacent bones. Imagine if you had a 400 foot long scale model of a conveyor belt!! You'd have DAYS of bone setup regardless of it's shape. The smaller N gets, the more bones you have..... 2010-03-18T22:55:56+01:00 append numbers to name http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/append-numbers-to-name/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/append-numbers-to-name/page-last/#When:22:43:52Z Thought I'd post this since it seems I can't find an example of what I'm trying to do. Basically, if I have a bunch of objects that are already named correctly. I just want to append a unique number to them. thanks 2010-03-18T22:43:52+01:00 Global Variables http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/global-variables/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/global-variables/page-last/#When:15:50:30Z Is there a way of grabbing a list all Maxscript-created global variables? I`m working on a debugging tool at the moment and it would be really useful to have these variables in my UI to view/edit. thanks, andy 2010-03-17T15:50:30+01:00 Download Python & PyQt for 3dsMax from Blur http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/download-python--pyqt-for-3dsmax-from-blur/page-last/ http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/download-python--pyqt-for-3dsmax-from-blur/page-last/#When:15:55:22Z Merry Christmas to all! A bit early, I know...but time to share anyway... We have developed a way to run Python in 3dsMax by exposing Maxscript as a module to Python. Utilizing Python and PyQt to develop tools, we're hoping to revolutionize the ability to develop fast, efficient and powerful utilities. All the information you need to get going can be found at our new development website: http://blur-dev.googlecode.com Please feel free to post on the wiki pages for requests, bugs, and comments. Its still very beta and are looking forward to trying to make this the new future of programming in 3dsMax. Please keep in mind - this is very much beta, and the code is as-is, but we will appreciate feedback as it'll make our own code more stable. Enjoy! Eric Hulser Tools Developer Blur Studio 2010-03-16T15:55:22+01:00