Objekt-Abmessungen in Viewport anzeigen

Mit diesem Script lassen sich die Abmessungen selektierter Objekte anzeigen.
Das Script ist als Button definiert, wenn es per drag&drop in 3Ds Max gezogen wurde ist es zu finden unter Customize User Interface / Kategorie: jb_scripts.

Download: jb_scripts-OBJDimension

jb_objDimension

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
Get Object Dimension from jb_alvarado | 2013 | www.pixelcrusher.de
no Copyright restriction 
use it at your on risk
 
Tested in 3ds Max 2013/2014
 
This Script get the dimension from selection and draw this in the current screen.
For the best use copy it in the scripts folder, then drag and drop it in the 3ds max screen, after that go to:
Customize/Customize User Interface/Toolbars/Category/jb_scripts/Live Dimension in Viewport
and drag this in your Toolbar.
*/
 
macroScript OBJDimension
category:"jb_scripts"
tooltip:"Live Dimension in Viewport"
buttonText:"Dimension"
(
    global GW_displayObjectNames
    on isChecked return ::drawInViewportEnabled
    on execute do (
        if ::drawInViewportEnabled != true and ::drawInViewportEnabled != false do ::drawInViewportEnabled = false
        ::drawInViewportEnabled = not ::drawInViewportEnabled
        if ::drawInViewportEnabled then (            
            unregisterRedrawViewsCallback GW_displayObjectNames
            fn GW_displayObjectNames = (
                    if ( selection.count == 1 ) then (
                        if ( superclassof selection[1] == shape ) then (
                            local shapeLength = " | Shapes Length: " + ( units.formatValue ( curveLength selection[1] ) as string )
                            ) else (
                                local shapeLength = ""
                                )
                                
                        bound = nodeGetBoundingBox selection[1] selection[1].transform
                        dim = ( bound[2] - bound[1] )
 
                        local objX = ( units.formatValue dim.x as string )
                        local objY = ( units.formatValue dim.y as string )
                        local objZ = ( units.formatValue dim.z as string )
                        
                        if selection[1].name.count > 16 then (
                            selName = "[" + ( substring selection[1].name 1 16 ) + ".]"
                            ) else (
                                selName = "[" + selection[1].name + ".]"
                                )
    
                        gw.wText [14,33,0] ("Dimension From " + selName + ":  X: " + objX + " | Y: " + objY + " | Z: " + objZ + shapeLength) color: ( color 229 204 25 )
                        ) else if ( selection.count > 1 ) then (
                            local objMin = selection.min
                            local objMax = selection.max
                            local objX = ( units.formatValue ( objMax.x - objMin.x ) as string )
                            local objY = ( units.formatValue ( objMax.y - objMin.y ) as string )
                            local objZ = ( units.formatValue ( objMax.z - objMin.z ) as string )
                            gw.wText [14,33,0] ("Dimension From Selection:  X: " + objX + " | Y: " + objY + " | Z: " + objZ ) color: ( color 229 204 25 )
                            )
                gw.enlargeUpdateRect #whole
                )
            registerRedrawViewsCallback GW_displayObjectNames
        ) else    (
            shapeLength = undefined
            objMin = undefined
            objMax = undefined
            objX = undefined
            objY = undefined
            objZ = undefined
            unRegisterRedrawViewsCallback GW_displayObjectNames
            forceCompleteRedraw()
            )
        )        
)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.