contour generator

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  05 May 2011
contour generator

Hi

This is a small toy that expands one of the examples from the maxscript help file, used to generate contour splines of objects using the section shape. I needed to use this functionality for a small task, and took the time to build a UI for it.
Enjoy
Attached Images
File Type: jpg contour.jpg (81.9 KB, 80 views)
Attached Files
File Type: txt contours.ms.txt (6.8 KB, 21 views)
 
  05 May 2011
very cool, thanks for sharing!
 
  05 May 2011
Originally Posted by lo: Hi

This is a small toy that expands one of the examples from the maxscript help file, used to generate contour splines of objects using the section shape. I needed to use this functionality for a small task, and took the time to build a UI for it.
Enjoy


i would do it by slicing poly copy of the node with slice planes and creating shapes from edge selection.

like:

 fn sliceAndShape node:selection[1] slices:1 curved:off dir:#z = if canconvertto node Editable_Poly do  
(
	temp = converttopoly (copy node)
	bbox = nodeGetBoundingBox temp temp.transform
	step = (bbox[2] - bbox[1])/(slices+1)
	vec = case dir of
	(
		 #x: [1,0,0]
		 #y: [0,1,0]
	default: [0,0,1]
	)
	sp = #()
	for k=1 to slices do
	(
		temp.slice vec (bbox[1] + vec*step*k)
		if (temp.createShape ("sp_" + k as string) curved node) do
		(
			append sp shapes[shapes.count]
			shapes[shapes.count].parent = node
		)
	)
	delete temp
	sp
)
/*
(
	gc()
	delete objects
	teapot isselected:on
	sliceAndShape slices:20 dir:#x
)
*/

Last edited by denisT : 05 May 2011 at 10:26 PM.
 
  05 May 2011
An older version of Contour Creator by Rab Gordon.
 
  05 May 2011
very nice, denis. seems faster.
There is also no need to create the spline every step of the way, you can substitute with:
if k == slices and (temp.createShape ("sp_" + k as string) curved node) do
 
  05 May 2011
Originally Posted by lo: very nice, denis. seems faster.
There is also no need to create the spline every step of the way, you can substitute with:
if k == slices and (temp.createShape ("sp_" + k as string) curved node) do

every new slice resets edge selection...
 
  05 May 2011
I am not sure what you mean exactly, but your code generates a redundant spline for every iteration, and the line I changed only creates the spline on the last iteration... in your example teapot it seems to work fine...
 
  05 May 2011
Originally Posted by lo: I am not sure what you mean exactly, but your code generates a redundant spline for every iteration, and the line I changed only creates the spline on the last iteration... in your example teapot it seems to work fine...

with your correction the code has to make the shape for the last slice only.
maybe the method doesn't update selection on every slice. if so it's better to do it forcing update node.

Last edited by denisT : 05 May 2011 at 08:50 AM.
 
  05 May 2011
Originally Posted by denisT: maybe the method doesn't update selection on every slice.

I assume it does and is additive, because the final spline is correct. Can you show a case in which it doesn't?
 
  05 May 2011
Originally Posted by lo: I assume it does and is additive, because the final spline is correct. Can you show a case in which it doesn't?

if it's additive it's a bug. i need to deselect all edges before every iteration. or update mesh after an iteration. updating is definitely slower.
 
  05 May 2011
why not just deselect all edges before starting the loop?
 
  05 May 2011
Originally Posted by lo: why not just deselect all edges before starting the loop?


i think the better solution is to have an option - combine. if combine is true we will go your way: deselect edges, make all slices without mesh update, and make a shape; if combine is false (to have a shape per slice) we will go my way: deselect edges before every slice, make slice, and make shape on every iteration.
 
  05 May 2011
Originally Posted by denisT: i think the better solution is to have an option - combine. if combine is true we will go your way: deselect edges, make all slices without mesh update, and make a shape; if combine is false (to have a shape per slice) we will go my way: deselect edges before every slice, make slice, and make shape on every iteration.

I agree. Do you mind if I use your code sample as a basis for a different version of the tool?
 
  05 May 2011
Originally Posted by lo: I agree. Do you mind if I use your code sample as a basis for a different version of the tool?

sure. no problem.
 
  05 May 2011
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed 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 10:51 AM.


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