[インタフェース](Interfaces) > [コア インタフェース](Core Interfaces) > [PlacementTool] |
PlacementTool コア インタフェースは、MAXScript に配置ツールのコントロールおよび機能を公開します。3ds Max 2015 以降で使用可能です。
プロパティ:
PlacementTool.ActiveMode : bool : Read|Write
配置ツールの使用可能状態を取得/設定します。
False(既定値)に設定すると、配置ツールは無効になります。
True に設定すると、レイの交差を実行して、その他のすべてのシーンのジオメトリとともに選択したオブジェクトをシーン内にインタラクティブに配置するか、 PlacementTool.RotateMode プロパティの状態に応じて回転することができるようになります。
PlacementTool.RotateMode : bool : Read|Write
[回転](Rotate)モードの状態を取得/設定します。
False(既定値)に設定した場合、ビューポート内でマウスを移動すると、シーン ジオメトリを使用したレイの交差を実行し、選択を交差点に配置します。
True に設定した場合、マウスを上下に移動すると、選択したオブジェクトを軸を中心に回転します。
PlacementTool.UseBase : bool : Read|Write
[ベースを基点として使用](Use Base As Pivot)オプションの状態を取得/設定します。
False(既定値)に設定すると、オブジェクトのピボットを使用して、位置合わせまたは回転を実行します。
True に設定すると、代わりにオブジェクトの基点が使用されます。
PlacementTool.PillowMode : bool : Read|Write
[枕モード](Pillow Mode)オプションの状態を取得/設定します。
PlacementTool.AutoParent : bool : Read|Write
[自動ペアレント化](Auto-Parent)オプションの状態を取得/設定します。
False(既定値)に設定すると、オブジェクトが親子関係を変更せずに配置されます。
True に設定した場合、オブジェクトは、サーフェスが配置されているオブジェクトに自動的にペアレント化されます。
PlacementTool.UpAxis : enum : Read|Write UpAxis enums: {#Positive_X | #Positive_Y | #Positive_Z | #Negative_X | #Negative_Y | #Negative_Z}
[オブジェクト アップ軸](Object Up Axis)オプションの状態を取得/設定します。
既定値は #Positive_Z です。
このオプションは、配置されたオブジェクトのどの軸がサーフェスの法線に沿って方向付けされるのかをコントロールします。
メソッド:
<void>PlacementTool.ShowOptionDialog()
[配置設定](Placement Settings)オプション ダイアログを開きます。
3ds Max 2016 以降で使用可能です。
<INTPTR>PlacementTool.GetCommandMode()
配置ツールのコマンド モードをポインタ値として返します。
3ds Max 2016 以降で使用可能です。
<value>PlacementTool.HitTestScene <&ray>Ray Ray is In parameter
by-reference In パラメータとして渡されるレイ値を使用して、シーンに対してヒット テストを実行します。
<bool>PlacementTool.PlaceNode <time>Time <node>SelectedNode <&point3>Position <&point3>Normal <node>TargetNode <bool>bRotateUpAxisToNormal Position is In parameter Normal is In parameter
PlacementTool.HitTestScene () メソッドから取得された Position および Normal の値を使用して、所定の時間に指定されたターゲットのサーフェス上に、指定されたノードを配置します。
Time 引数はオブジェクトを評価する時間を指定します。
SelectedNode 引数は配置されるノードを指定します。
&Position 引数はパラメータの by-reference として位置を渡します。
&Normal 引数はパラメータの by-reference として法線ベクトルを渡します。
TargetNode 引数はサーフェスを配置に使用するノードを指定します。
bRotateUpAxisToNormal ブール演算引数は、配置されたノードのアップ軸( PlacementTool.UpAxis によって決定)を交差ポイントでサーフェス法線に向けるかどうかを指定します。
例 |
( resetMaxFile #noprompt --Create some geometry to test against local p = plane width:210 length:210 widthsegs:200 lengthsegs:200 local s = sphere radius:50 segs:100 pos:[14,15,-25] local n = noiseModifier() addModifier p n n.strength = [0,0,50] n.scale = 50.0 local theObjects = #() --collect objects to be placed in this array for y = -100 to 100 by 5 do ( for x = -100 to 100 by 5 do ( local c = cone pos:[x,y,100] radius1:3 height:5 wirecolor:blue --create a grid of cones above the surfaces append theObjects c --collect the cones in the array ) ) local st = timestamp() --get a time stamp for o in theObjects do --loop though all cones ( local result = PlacementTool.HitTestScene (Ray o.pos [0,0,-1]) --intersect a ray down the -Z local minDist = 100000.0 --initialize a variable for the minimum distance local newPos = o.pos --set the new position to the current position of the current cone local newNormal = o.dir --set the new normal to the current direction of the current cone local theTarget = undefined for i in result do --loop through all results ( local dist = (distance i[2].pos o.pos) --calculate the distance to the hit if dist < minDist do --if it was closer, ( minDist = dist --set the minimum distance to the current distance value newPos = i[2].pos --record the position newNormal = i[2].dir --and the normal theTarget = i[1] --remember the object that was hit ) ) if theTarget != undefined do --only place the object if a target was found PlacementTool.PlaceNode currentTime o &newPos &newNormal theTarget true ) format "Placement of % objects took % ms.\n" theObjects.count (timestamp()-st) --print the time ) |
![]() |