Generate Spline in the Middle of a Geometry

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  07 July 2017
Generate Spline in the Middle of a Geometry

Hi.

Is there a way to generate a spline in the middle of a geometry much like the one below? I understand there is an "Edge to Spline" command but it does not generate in the middle of a geometry. **

Please see file below for reference
Reference

Thank you for your time.*
 
  07 July 2017
Yes, it is possible.

Select every other edge loop and use Character->Conversion->Selection to Joints command (hold down shift when using it). *Group the resulting joints into a hierarchy and then you can use*Character->Conversion->Joints to Spline to get your spline.

It must be every other edge loop because the command is converting the selection to points on the fly, so technically the points would be contiguous even though as an edge selection they don't appear to be.

-kvb
 
  07 July 2017
Originally Posted by kvb: Yes, it is possible.

Select every other edge loop and use Character->Conversion->Selection to Joints command (hold down shift when using it). *Group the resulting joints into a hierarchy and then you can use*Character->Conversion->Joints to Spline to get your spline.

It must be every other edge loop because the command is converting the selection to points on the fly, so technically the points would be contiguous even though as an edge selection they don't appear to be.

-kvb


Thanks for the response. Just tried it but having this in "It must be every other edge loop" is somewhat time consuming (considering I have more than hundreds of them. Haha). Even if I take the COFFEE command line script for automation, the selection of the every other edge loop is manual.*

Is there a faster way to do this?*

I was thinking of somewhere along the line of this version*
https://www.youtube.com/watch?v=kjVH_VKHMmQ
 
  07 July 2017
Sorry for the delay. *It doesn't literally have to be "every other". *I was just pointing out, in the context of my example instructions,*that the selection must be non-contiguous points. *Really you just need to make enough loop selections to cover the path of your object accurately and let the intermediate points of the resulting*spline rectify any lack of smoothing.

-kvb
 
  07 July 2017
Originally Posted by kvb: Sorry for the delay. *It doesn't literally have to be "every other". *I was just pointing out, in the context of my example instructions,*that the selection must be non-contiguous points. *Really you just need to make enough loop selections to cover the path of your object accurately and let the intermediate points of the resulting*spline rectify any lack of smoothing.

-kvb

Hi. Thanks for the reply. Just to confirm, to be able to get this working, you need to click a single edge ring then proceed to the conversion. The problem is I have several tubes that is quite long and selected on a per edge basis rather than on per tube basis is somewhat time consuming.*

You can see what I am referring here:*https://www.dropbox.com/s/znr3h1o76...pline3.mp4?dl=0

I appreciate your response and it works but I am not sure there is a way to automate that selected single edge ring for all the several tubes.*
 
  07 July 2017
Originally Posted by bentraje: Hi. Thanks for the reply. Just to confirm, to be able to get this working, you need to click a single edge ring then proceed to the conversion. The problem is I have several tubes that is quite long and selected on a per edge basis rather than on per tube basis is somewhat time consuming.*

You can see what I am referring here:*https://www.dropbox.com/s/znr3h1o76...pline3.mp4?dl=0

I appreciate your response and it works but I am not sure there is a way to automate that selected single edge ring for all the several tubes.*

You can do it that way, but it's a lot slower. Try loop selections instead and make several non-contiguous selections and hold down shift when firing off the selection to joints command.

This is a sloppy example, but it should illustrate just how few selections you need to get a fairly accurate spline, but I would recommend increasing the number of selections to avoid a lot of cleanup afterwards.

-kvb


__________________
www.kvbarnum.com
LOBODESTROYO!!!
 
  07 July 2017
Hi Kvb. Thanks for the response. That is indeed an easier route.

With regards to the generated joints, is there a way to make them immediately in hierarchy (Parent-child)?

Currently, I'm doing them manually where I figure out which is the child and which is the parent.

As I understand,they need to be in hierarchy for the joints to spline command to work.*
 
  07 July 2017
Originally Posted by bentraje: Hi Kvb. Thanks for the response. That is indeed an easier route.

With regards to the generated joints, is there a way to make them immediately in hierarchy (Parent-child)?

Currently, I'm doing them manually where I figure out which is the child and which is the parent.

As I understand,they need to be in hierarchy for the joints to spline command to work.


Here's a script that might be helpful, but keep in mind there's a bug with the*GETACTIVEOBJECTFLAGS_SELECTIONORDER flag where the selection order isn't maintained with shift/rectangle selecting multiple objects. You'll need to add each joint to the selection one at a time (and even then c4d loses the selection order after an undo).


import c4d
from c4d import gui
#Welcome to the world of Python


def main():
    doc.StartUndo()
    activeObjects = doc.GetActiveObjects(flags=c4d.GETACTIVEOBJECTFLAG  S_SELECTIONORDER)
    rootObj = activeObjects[0]
    #print rootObj.GetName() 
    
    for obj in activeObjects:
        if obj != rootObj:
            doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj)
            obj.InsertUnder(rootObj)
            rootObj = obj
            
    c4d.EventAdd()
    doc.EndUndo()
   

if __name__=='__main__':
    main()
__________________
www.kvbarnum.com
LOBODESTROYO!!!
 
  07 July 2017
Originally Posted by kvb: Here's a script that might be helpful, but keep in mind there's a bug with the*GETACTIVEOBJECTFLAGS_SELECTIONORDER flag where the selection order isn't maintained with shift/rectangle selecting multiple objects. You'll need to add each joint to the selection one at a time (and even then c4d loses the selection order after an undo).


import c4d
from c4d import gui
#Welcome to the world of Python


def main():
    doc.StartUndo()
    activeObjects = doc.GetActiveObjects(flags=c4d.GETACTIVEOBJECTFLAG  S_SELECTIONORDER)
    rootObj = activeObjects[0]
    #print rootObj.GetName() 
    
    for obj in activeObjects:
        if obj != rootObj:
            doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj)
            obj.InsertUnder(rootObj)
            rootObj = obj
            
    c4d.EventAdd()
    doc.EndUndo()
   

if __name__=='__main__':
    main()

Thanks for the response. Apparently, the script does not seem to work. What I did was I click the Object A then Object B then run the script but I don't see any changes.*

Alternatively, I use a script referred in this video (https://vimeo.com/37115578). Saw this a long time ago and figured this will come in handy some day.*

Thanks again!*
 
  07 July 2017
On a side note, multiple looping selections can sometimes be achieved quickly using the UV editor. Helpful when dealing with hundreds of objects....caveats are the UVs need to be laid out in a grid, like the UVs when a primative sweep is collapsed . Another minor issue is multiple objects UVs are not all displayed together when all objects are selected, so combining all objects into one mesh is necessary. Selecting rows or columns of UV faces or points selects all shapes loops at the same time. Convert UV selection to model edges ( command click on edges icon), run edge to spline. If too many points are generated in the new splines, reduce the splines using mospline in spline mode.

to get the individual objects back again and with an axis that points in a logical direction for each object and not all in the same world space, first select a single face in UV editor ( so each object will have one face selected after breaking apart mesh), then break apart mesh into objects, and run axis to center with normals enabled so that the selected face orients each objects new centered axis.
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:47 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.