2015-10-13 76 views
0

我一直在爲一個問題奮鬥了幾天。 我需要一個自定義樣條形狀的鑽機我正在做,爲一個catarpillar軌道周圍4個獨立移動的車輪(牆-E)MaxScript中的自定義樣條線基元(3ds Max)

我想樣條是一個四邊形,與4個獨立的角圓角一定量(基於車輪半徑的半徑)。

我的問題是,我似乎無法創建一個自定義SplineShape(就像我可以與網格幾何)。

我被困在這裏:

plugin shape FilletQuad 
name: "FilletQuad" 
classID:#(0x32cdee2b, 0x56acdf01) 
extends:SplineShape version:1 
category:"Splines" 
( 

parameters main rollout:ro_filletQuad 
(
    x1 type:#float animatable:true default:-30 ui:sp_x1 
    y1 type:#float animatable:true default:20 ui:sp_y1 
    r1 type:#float animatable:true default:10 ui:sp_r1 
) 

rollout ro_filletQuad "Hardware Shaders" 
(
    label lbl_point1 "Point 1:" 
    spinner sp_x1 "x:" 
    spinner sp_y1 "y:" 
    spinner sp_r1 "radius:" 
) 

fn createShape = 
(
    print "code for shape creation goes here.." 
) 

tool create 
(
    local startPoint 
    on mousePoint click do 
     case click of 
     (
      1: startPoint = nodeTM.translation = gridPoint 
      2: (
       createShape() 
       #stop 
      ) 
     ) 
    on mouseMove click do 
    (
     case click of 
     (
      2: (
       print "Dragging - N/A for this primitive" 
      ) 
     ) 
    ) 
) 
) 

我需要一種方法來引用基對象,並建立了花,並重建它,當永遠的參數變化。

在幾何中,我使用「on buildMesh」事件,然後構建「mesh」變量。但我似乎無法找到形狀相同的屬性。

任何幫助?

回答

1

我相信因爲你正在擴展一個現有的插件(SplineShape),所以你需要使用關鍵字代理訪問插件的祖先並修改任何繼承的參數。

如果你看看腳本形狀插件的例子,並閱讀文檔,很明顯,當你擴展插件,你基本上使用它作爲基礎,並在創建時添加功能。

似乎允許用戶從頭開始定義幾何創建的唯一插件是simpleobject插件。

通過maxscript創建插件相對有限。您可以通過創建與視口視圖大小(有點像點設置)保持一致來表示樣條線的網格來作弊。

希望這會有所幫助。

1

如果您使用的是max 2016 SP2或更高版本,則可以使用simpleSpline。這個腳本化的自定義原始類是在MCG的基礎上添加的,所以沒有maxscript方法來處理這個形狀。當然,您可以始終使用.NET方法。查看ArrowPulley BeltGuilloche腳本形狀以查看設置。