How to write on this plugin for naming edges?

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
  07 July 2013
local point3 ve1 = polyop.getVert pick.Object verts[1]
local point3 ve2 = polyop.getVert pick.Object verts[2]



local projx = abs( ve1.x - ve2.x as float) --7
local projy = abs( ve1.y - ve2.y as float) --0
local projz = abs( ve1.z - ve2.z as float) -- 0

local Largest = 1 as integer

if projx < 1.0e-6 and projy < 1.0e-6 do -- vertical
Largest = 1


if projy < 1.0e-6 and projz < 1.0e-6 do -- sideway
Largest = 2

if projx < 1.0e-6 and projz < 1.0e-6 do -- inner
Largest = 3

MessageBox (Largest as string)
Edge_Name = name

if Largest == 1 do
Edge_x = ve1.x as float
Edge_y = ve1.y as float
Edge_z = 0.0

else if Largest == 2 do
MessageBox (ve1.y as string)
Edge_x = 0.0
Edge_y = ve1.y as float
Edge_z = ve1.z as float

else if Largest == 3 do
Edge_x = ve1.x as float
Edge_y = 0.0
Edge_z = ve1.z as float


How come when the edge is sideways, Edge_y would become 0.0 while it isn't the case

Last edited by lucky6969c : 07 July 2013 at 09:14 AM.
 
  07 July 2013
Okay, for the last time, then I give up:

try destroyDialog name_edge catch()
rollout name_edge "Name Edge"
(
	fn isPoly obj = isKindOf obj Editable_Poly

	fn getIndexOfMax x y z =
		if x > y then (if x > z then 1 else 3)
		else (if y > z then 2 else 3)

	fn absP3 p3 =
		[abs p3.x, abs p3.y, abs p3.z]

	global Edge_Name
	global Edge_Point3

	editText name "Name: "
	pickButton pick "NONE" autoDisplay:true filter:isPoly

	on pick picked it do
	(
		if name.text.count < 1 do
			return messageBox "Edge name cannot be empty"
		if pick.object == undefined do
			return messageBox "No object selected"
		if pick.object.selectedEdges.count != 1 do
			return messageBox "Exactly one edge has to be selected"

		local verts = polyop.getEdgeVerts pick.object pick.object.selectedEdges[1].index
		local v1 = polyop.getVert pick.Object verts[1]
		local v2 = polyop.getVert pick.Object verts[2]

		Edge_Name = name.text
		local proj = absP3 (v1 - v2)

		case (getIndexOfMax proj.x proj.y proj.z) of
		(
			1 : Edge_Point3 = Point3 0 proj.y proj.z
			2 : Edge_Point3 = Point3 proj.x 0 proj.z
			3 : Edge_Point3 = Point3 proj.x proj.y 0
		)

		messageBox (Edge_Name + " : " + Edge_Point3 as string)
	)
)
createDialog name_edge
__________________
Scripts :: linkedin
 
  07 July 2013
Thanks, it okay now.
But I am onto the SDK, for getting back the info from maxscript
I am looking for ways to map maxscript variable to the SDK


 Value *x;
 Value *y;
 Value *z;
 Value *Name;
 
  
 
 
 Value* get_Edge_X()
 {
    return (Value*)x;
 
 }
 
 void SetEdgeX(Value* _x)
 {
    x = _x;
 }
 
 
 Value* set_Edge_X(Value* val)
 {
 	SetEdgeX(val);
 	return val;
 }
 
 
  
 Value* get_Edge_Y()
 {
    return (Value*)y;
 
 }
 
 void SetEdgeY(Value * _y)
 {
 	y = _y;
 }
 
 
  
 Value* set_Edge_Y(Value* val)
 {
 	SetEdgeY(val);
 	return val;
 }
 
 Value* get_Edge_Z()
 {
    return (Value*)z;
 
 }
 
 void SetEdgeZ(Value *_z)
 {
 	z = _z;
 }
 
 
 Value* set_Edge_Z(Value* val)
 {
 	SetEdgeZ(val);
 	return val;
 }
 
  
 Value* get_Edge_Name()
 {
 	return (Value*) Name;
 }
 
 void SetEdgeName(Value *_name)
 {
 	Name = _name;
 }
 
  
 Value* set_Edge_Name(Value* val)
 {
 	SetEdgeName(val);
 	return val;
 }
 



 void SimExporter::Init(HWND hWnd)
 {
 
   //MessageBox(NULL, "Here", "Here", NULL);
   define_system_global("Edge_Name", get_Edge_Name, set_Edge_Name); 
   define_system_global("Edge_x", get_Edge_X, set_Edge_X); 
   define_system_global("Edge_y", get_Edge_Y, set_Edge_Y); 
   define_system_global("Edge_z", get_Edge_Z, set_Edge_Z); 
   try {
 	XMLPlatformUtils::Initialize();
   }
   catch (const XMLException& toCatch) {
 	// Do your failure processing here
 	OutputDebugString("XML Serializer init failed");
 	return;
   }
 }
 


When I try to retrieve the X value, I get a NULL

Value *x = get_Edge_X();
float val = x->to_float();
printf ("%f\n", val);

Last edited by lucky6969c : 07 July 2013 at 10:41 AM.
 
  08 August 2013
I am so mixed up now.
Could anyone supply a editable mesh version of this applet?

persistents.removeall()
		 
		if name.text.count < 1 do
			return messageBox "Edge name cannot be empty"
		if pick.object == undefined do
			return messageBox "No object selected"
		if pick.object.selectedEdges.count != 1 do
			return messageBox "Exactly one edge has to be selected"

		local verts = polyop.getEdgeVerts pick.object pick.object.selectedEdges[1].index

		
--		append edges (edgeInfo name:name.text v1:(polyop.getVert pick.object verts[1]) v2:((polyop.getVert pick.object verts[2])))

		local point3 ve1 = polyop.getVert pick.Object verts[1]
		local point3 ve2 = polyop.getVert pick.Object verts[2]
		
 

		local projx = abs( ve1.x - ve2.x as float) --7
		local projy = abs( ve1.y - ve2.y as float) --0
		local projz = abs( ve1.z - ve2.z as float) -- 0

Thanks
Jack
 
  08 August 2013
local theObj = selection[1]

--local theEdge = getEdgeSelection theObj


local vert1 = getVert theObj 1
local vert2 = getVert theObj 2

The problem with this is the indices of 1 and 2 not always pointing to the the right edges. A mesh can contain a thousands of edges....
How do get the indices of the vertices of the edges currently selected?
Thanks
Jack
 
  08 August 2013
http://docs.autodesk.com/3DSMAX/15/...C7E4D379D8C.htm

local theEdge = getEdgeSelection theObj

theEdge.showproperties

How come getEdgeSelection is undefined, is that a built in function for maxscript?
I have selected a mesh edge for sure.
Why?
Thanks
Jack
 
  08 August 2013
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 04:44 PM.


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