美文网首页
3dmax对齐到指定物体表面

3dmax对齐到指定物体表面

作者: Rayson | 来源:发表于2024-05-30 13:18 被阅读0次
if floater_B != undefined do
(
    closerolloutfloater floater_B
)
floater_B = newrolloutfloater "场景处理B" 240 300

------------------------------------------------------------------------------------
rollout newroll_3 "对单个或多个物体操作"
(
    button align2surf "对齐到指定物体表面" pos:[10,2] width:120 height:18 tooltip:"选择一个或多个几何体将对齐到目标物体表面,选择单个几何体的点将点对齐到目标物体表面,选择单个线条将所有点对齐到目标物体表面。"
    button flat_line "弄平样条线" pos:[140,2]    width:70 height:18 tooltip:"弄平一条或多条样条线。"
    edittext zz "Z坐标" text:"0" pos:[10,20] width:70 height:18
    button z_p "one shape's verts pos.Z set" pos:[80,20] width:140 height:18 tooltip:"选择的单个shape的选择的单个或多个点的Z坐标设置为左边的值"
    button del_modifier "删除第一个修改器" pos:[10,38] width:120 height:18 tooltip:"删除选择物体的第一个修改器,没有修改器的将不操作。"
    button reset_shape "重置样条线" pos:[140,38] width:70 height:18 tooltip:"跟统一物体坐标是一样的道理,总之碰到怪问题时对线条操作。"
    button noclose "分离未封闭的线条元素" pos:[5,56] width:120 height:18 tooltip:"对单个物体操作,分离线条内未封闭的元素"
    button dir "统一样条线方向" pos:[130,56] width:90 height:18 tooltip:"对单个物体操作,先对线进行0.001的outline,再执行此命令!既可统一线内元素的方向,为下一步做好准备。"

    button duiqi "对齐选择的点到指定面(相对移动)" pos:[10,74] width:200 height:18 tooltip:"将物体的选择点一起移动某个距离对方到目标表面(即选择的点整体移动)。"
    
    group "复制多个物体并对齐目标物体" 
    (
        checkbox rotate_ "旋转适配" pos:[13,114] tristate:1
        checkbox scale_ "缩放适配" pos:[100,114] tristate:1
        pickbutton getG "点选目标物体组" pos:[13,134] width:110 height:16 tooltip:"简面用的工具,如段数很多的圆柱可以用段数少的圆柱来复制对齐。"
        button copy_M "开始复制物体" pos:[130,139] width:80 height:16 tooltip:"简面用的工具,如段数很多的圆柱可以用段数少的圆柱来复制对齐。"
    )
    button rotateAlgin "根据选择的两个点旋转物体到正方向" pos:[10,170] width:200 height:18
-------------------------------------------------------------
    on z_p pressed do
    (
        v_g=getKnotSelection $ 1
        num=v_g.count
        for i = 1 to num do
        (
            a=getKnotPoint $ 1 v_g[i]
            pos_=a
            pos_.z=zz.text as float
            setKnotPoint $ 1 v_g[i] pos_
        )
        updateShape $
    )
    on noclose pressed do
    (
        global open_ = #()
        numS = numSplines $
        for i = 1 to numS do
        (
            if isClosed $ i == false do append open_ i
        )
        subobjectLevel = 3
        setSplineSelection $ open_
        splineOps.detach $
    )
-------------------------------------------------------------
    on dir pressed do
    (
        subobjectLevel = 0
        global tempS = #()
        numS = (numSplines $)/2
        for i = 1 to numS do
        (
            orL = curveLength $ i
            cL = curveLength $ (i+numS)
            out = cL - orL
            if out < 0 do reverse $ i
            append tempS (i + numS)
        )
        subobjectLevel = 3
        setSplineSelection $ tempS
        splineOps.delete $
    )
------------------------------------------------------------
    on getG picked obj do
    (--1
        global sel = #()
        a=obj
        global b
        if a.parent == undefined then 
        (
            getG.caption = a.name + "(组)"
            b = a
        )
        else 
        (
            getG.caption = a.parent.name + "(组)"
            b = a.parent
        )
        print getG.caption
        sel = b.children
    )--1
-------------------------------------------------------------------------------------------
    on copy_M pressed do ----------复制多个物体并对齐目标物体
    (
        print "Eee"
        for i = 1 to sel.count do
        (
            cc = instance $
            
            cc.name = sel[i].name
            cc.wirecolor = sel[i].wirecolor
            cc.pos = sel[i].pos
            if rotate_.tristate == 1 do cc.rotation = sel[i].rotation
            if scale_.tristate == 1 do cc.scale = sel[i].scale
            --cc.pos.x = 0.5*(sel[i].max.x + sel[i].min.x)
            --cc.pos.y = 0.5*(sel[i].max.y + sel[i].min.y)
            --cc.pos.z = 0.5*(sel[i].max.z + sel[i].min.z)
        )
    )
-------------------------------------------------------------------------------------------
    on flat_line pressed do --------------弄平样条线
    (----1
         if selection.count == 0 do messageBox "请选择一个或多个线条" title:"联创警告!"
         for i = 1 to selection.count do
         (---2
            new_z = selection[i].pos.z 
            for s = 1 to (numSplines selection[i]) do 
            ( --s
                for k = 1 to (numKnots selection[i] s) do 
                ( --k
                    knt = getKnotPoint selection[i] s k 
                    in_vec = getInVec selection[i] s k 
                    out_vec = getOutVec selection[i] s k 
                    knt.z = in_vec.z = out_vec.z = new_z 
                    setInVec selection[i] s k in_vec 
                    setOutVec selection[i] s k out_vec 
                    setKnotPoint selection[i] s k knt 
                )--end k loop 
            )--end s loop 
            updateshape $
        )---2
    )----1
--------------------------------------------------------------------------------------------
    on align2surf pressed do -----------------对齐到指定物体表面
    (------dodo
        do
         (  --选择对齐到的物体
            if selection.count == 0 then messageBox "请选择一个或多个物体" title:"联创警告!" else
            (
                surf = pickObject message:"请选择一个几何体" 
                isObj = 0
                if classof(classof surf) == GeometryClass  then isObj = 1 else messageBox "请选择一个几何体" title:"联创警告!"
            )
         )
        while isObj == 0
        ---------------------------
        if selection.count > 1 do --对齐多个物体到物体表面
        (
            for i = 1 to selection.count do
            (
                testray = ray [selection[i].pos.x,selection[i].pos.y,(surf.max.z + 10000)] [0,0,-1]
                insurf = intersectRay surf testray
                if insurf != undefined do (move selection[i] [0,0,(insurf.pos.z - selection[i].min.z)])
            )
        )
        ---------------------------
        if selection.count ==1 and classof(classof selection[1]) == GeometryClass and subobjectLevel == 0 do --对齐单个几何体到物体表面
        (
            testray = ray [selection[1].pos.x,selection[1].pos.y,(surf.max.z + 10000)] [0,0,-1]
            insurf = intersectRay surf testray
            if insurf != undefined do (move selection[1] [0,0,(insurf.pos.z - selection[1].min.z)])
        )
        if selection.count ==1 and classof(classof selection[1]) == GeometryClass and subobjectLevel == 1 do  --对齐单个几何体的点到物体表面
        (
            vt = selection[1].selectedVerts
            for i = 1 to vt.count do
            (
                p=vt[i].pos
                testray = ray [(p.x),(p.y),(surf.max.z + 10000)] [0,0,-1]
                insurf = intersectRay surf testray
                if insurf != undefined do vt[i].pos = insurf.pos
            )
        )--end if
        if selection.count ==1 and classof(classof selection[1]) == shape and subobjectLevel == 0 do--对齐单个线条的所有到物体表面
        (
            num = numKnots selection[1]
            for i = 1 to num do
            (
                a = getKnotPoint selection[1] 1 i
                testray = ray [a.x,a.y,(surf.max.z + 10000)] [0,0,-1]
                insurf = intersectRay surf testray
                if insurf != undefined do (setknotpoint selection[1] 1 i insurf.pos)
            )
            updateShape selection[1]
        )
        if selection.count ==1 and classof(classof selection[1]) == shape and subobjectLevel == 1 do--对齐单个线条的所有到物体表面
        (
            v_g = getKnotSelection selection[1] 1
            num = v_g.count
            --num = numKnots selection[1]
            for i = 1 to num do
            (
                a = getKnotPoint selection[1] 1 v_g[i]
                testray = ray [a.x,a.y,(surf.max.z + 10000)] [0,0,-1]
                insurf = intersectRay surf testray
                if insurf != undefined do (setknotpoint selection[1] 1 v_g[i] insurf.pos)
            )
            updateShape selection[1]
        )
    )-------dodo
------------------------------------------------------------------------------------
)

addrollout newroll_3 floater_B

相关文章

  • blender中顶点吸附对齐的几点操作细节

    先看问题:如何使被移动物体的指定顶点(下图A点)与目标物体的指定顶点(下图B点)对齐? 方法1:利用"吸附基准点>...

  • C4D标签介绍

    1、对齐曲线(对象沿着曲线做运动)(重要) 操作,物体上面加对齐曲线,将路径拖拽到对齐曲线标签上。 通过位置修改其...

  • 编辑菜单的使用——对齐与旋转(6)

    一、对齐工具 让物体与物体之间,通过改变某一个物体的位置,来实现它的一个对齐效果。 使用方法: 1)菜单栏 - 修...

  • 3Dmax系列——纯小白入门篇(二)

    3Dmax操作介绍 3Dmax跟其他三维软件一样。想要上手就必须了解几点。 1.首先怎么创建物体。比如建模,那就...

  • 《视觉艺术用光》02

    辐射 根据物体表面颜色不同,照射到物体表面的光会被反射或吸收,白色的物体反射所有光波,黑色的物体吸收所有光波,红色...

  • Flutter 3. 页面布局

    Flutter中布局组件众多,大致有: Align: 对齐布局组件,指定child的对齐方式 AspectRati...

  • Flutter 组件

    Align对齐布局,指定child的对齐方式 AspectRatio调整宽高比,根据设置的宽高比调整child组件...

  • Ambient Occlusion技术方案综述

    所谓的Ambient Occlusion(AO),指的是当光源到某个物体表面上某点的射线被其他物体所遮挡时,用于计...

  • C++11拾穗

    C++11新关键字 alignas:指定对齐大小 alignof:获取对齐大小 decltype auto(重新定...

  • text-justify两端对齐

    参考网址:菜鸟教程 text-justify:此属性指定应怎样对齐文本以及对齐间距。

网友评论

      本文标题:3dmax对齐到指定物体表面

      本文链接:https://www.haomeiwen.com/subject/ccqlqjtx.html