Re: [Maya-Python] inserting a knot on curve at the point that is in closest proximity to another point in 3d space

2016-10-19 Thread Neil Roche
Hi,

You should look at the NurbsCurve methods in pymel.  You could use 
closestPoint() to get the vector of the point on curve2 from the closest 
point given (which would be the point on curve1, you vec_target), you could 
then use getParamAtPoint() which would return you a uvalue parameter from 
the point on curve2 which you get from the first method.  Then pass the 
uValue parameter into the insertKnotCurve command which should make you a 
knot at the correct place on your curve1. 

On Monday, 17 October 2016 22:11:10 UTC+1, s...@weacceptyou.com wrote:
>
> i see the polyListComponentConversion command. and its not doing exactly 
> what i was after, but maybe im using it wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e7b222f3-f4a1-49e2-83d7-2458cf14da8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] inserting a knot on curve at the point that is in closest proximity to another point in 3d space

2016-10-17 Thread sam
i see the polyListComponentConversion command. and its not doing exactly what i 
was after, but maybe im using it wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/bca2ee99-8a92-484f-995b-45d741b3c619%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] inserting a knot on curve at the point that is in closest proximity to another point in 3d space

2016-10-17 Thread sam
no worries Marcus, got it,

what about this:
#
import pymel.core as pm

crv1 = pm.PyNode('curve1')
crv2 = pm.PyNode('curve2')
loc = pm.createNode('locator')
locTransform = loc.getParent()

loc.setParent(crv2, s=True, r=True)
pm.delete(locTransform)
cpoc = pm.createNode('nearestPointOnCurve')

# connect ep[1] to locator local position
pm.connectAttr(crv2.editPoints[1], loc.localPosition, f=True)
crv1.worldSpace[0] >> cpoc.inputCurve
loc.worldPosition[0] >> cpoc.inPosition

closestPnt = cpoc.position.get() 

cmds.spaceLocator(n='closestPointLoc',p=closestPnt)
#

just need to create two curves near to each other and the locator created 
('closestPointLoc') shows the closest point. I just need there to be a Knot 
created on the curve at the position of this locator...

does this make sense?

thanks, 
Sam

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/06f81a42-6504-4d7a-8e97-e75b9c05df54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] inserting a knot on curve at the point that is in closest proximity to another point in 3d space

2016-10-16 Thread Marcus Ottosson
Have a look at the polyListComponentConversion

command.

It’s great that you post example code.

Example code make it crystal clear what it is you’re looking for. But what
would make it even better, is if your example code would run.

I was about to type up an example for you, but it’s difficult when your
example code doesn’t run. It would make helping you a lot easier if your
code would work; that means I can paste it in and be exactly where you are.
>From there, helping you means filling in the blanks. Those are my favourite
questions. Good for you, good for me. Win-win.

To work, your code would need (1) an import statement, (2) all nodes you
referenced (e.g. finger) and (3) somehow illustrate the problem. Most of
the time, this means the example would get longer; but it doesn’t have to
be. The finger variable could be perhaps just a polyCube of a certain
length. and your curves could be simple two-point curve nodes. Whatever
helps illustrate the problem, so that you can then apply it to your real
code.
​

On 16 October 2016 at 22:31,  wrote:

> hello,
>
> i have some code that finds the point on a curve closest to another curve:
>
> crv1 = pm.PyNode(finger + 'Centre')
> crv2 = pm.PyNode(finger + 'Cross')
> loc = pm.createNode('locator')
> locTransform = loc.getParent()
>
> loc.setParent(crv2, s=True, r=True)
> pm.delete(locTransform)
> cpoc = pm.createNode('nearestPointOnCurve')
>
> # connect ep[1] to locator local position
> pm.connectAttr(crv2.editPoints[1], loc.localPosition, f=True)
> crv1.worldSpace[0] >> cpoc.inputCurve
> loc.worldPosition[0] >> cpoc.inPosition
>
> vec_target = cpoc.position.get()
>
> the result of this is the location in 3d space of the point on one curve
> closest to the other curve.
>
> what i want to know is how can i insert a knot on the other curve based on
> this point now found in 3d space. I needs to somehow be converted to a .u[]
> parameter value so it can be used in the insertKnotCurve command
>
>
> thanks,
> Sam
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/5835457c-256f-4130-8037-
> d1e586c69fa7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Marcus Ottosson*
konstrukt...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCT0iHEKmdds8fKYEMibOs4zf2A2EZDM--OyRuS%3DiatGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.