微信公众号 小红书 抖音 B站
小黑屋 渝ICP备2023015870号-1
网信算备88888888号
生成式人工智能服务管理暂行办法
备案号:88888888-20240226
首页 插件专区 Max插件 编辑 Flatten Shapes 样条线拉直【源码备份】
Flatten Shapes 样条线拉直【源码备份】
查看 11 下载 0 收藏 纠错
  • 应用平台: Windows 7 , Windows 8 , Windows 10 , Windows 11
  • 软件支持: 32位/64位
  • 界面语言: 多语言支持

(

fn CreateShp A B = (

spl = splineshape wirecolor:black

addnewspline spl

addKnot spl 1 #corner #line A

addKnot spl 1 #corner #line B

updateShape spl

spl

)

undo "Unfold Shape" on (

local Allshps = #()

for SP in selection where isKindOf SP shape and converttosplineshape SP != undefined do (

max create mode

for i = 1 to (numSplines SP) do (

local CW

local shp = splineshape wirecolor:black

local numS = numSegments SP i

local segL = getSegLengths SP i

local p1 = getKnotPoint SP i 1 , p2 = getKnotPoint SP i 2

---- check if the shape is CW or CCW (Work if the Shape is Flat on Z Axis only)

if p1.x >= p2.x then (if p1.y >= p2.y then CW = 1 else CW = -1)

else (if p1.y <= p2.y then CW = 1 else CW = -1)

----

for s = 1 to numS do (

local spl, A = [0,0,0], B = [segL[numS+s]*CW,0,0]

spl = CreateShp A B

spl.Pivot = A

local V = 0

if s != 1 do (

for k = numS+1 to numS+s-1 do V += segL[k]*CW

spl.pos = [V,0,0]

)

addAndWeld shp spl -1

)

weldSpline shp 0.1

for i = 1 to (numSplines shp) do (

setKnotSelection shp i #()

for v = 1 to numKnots shp i do setKnotType shp i v #corner

)

updateShape shp ; CenterPivot shp

shp.pos = SP.pos

shp.name = SP.name+" Spl"+(i as string)+"_Flatten"

append Allshps shp

)

)

select Allshps

)

clearListener()

)


发表评论
  • 顺带评个分
提交
  • 834544123 在线客服

  • 周一至周五:9:00-21:00

    周末及节日:9:00-18:00

  • QQ&微信:
    834544123
    QQ群:
    16538234