Originally, we used the mouse to find the point and structured it into a painting tool. Next, I will study the process of painting points .)

Source: Internet
Author: User

---- The first part is to create a patch on the left and right sides of the model.
---- If you select to create a patch in front of an object
/*
$. Examples. x = $. Min. x + 0.5 * ($. Max. X-$. Min. X );
$. Examples. Y = $. Min. Y + 0.5 * ($. Max. Y-$. Min. y );
$. Examples. z = $. Min. Z + 0.5 * ($. Max. Z-$. Min. Z)
*/
---- Use the following method to create the position of a part.
/*
Center.pdf $
$. Examples. Y = $. Max. Y + ($. Max. Y-$. Min. Y)
*/
---- Use variables that collect coordinates for collection activities.
---- A three-dimensional coordinate after the event is processed.
----- It is better not to operate on the group.

----- The positive direction of Y
----- If the function is ready to be changed, it is now in the positive direction, not right,
----- I used the mouse to create a vertex. I just wanted to ask him to move it out of the axis.
Function sel_effect_axis axis_string =
(
Case
(
(Axis_string = "Y + "):
(
-- Sel_effect_y = $. Pos

Sel_effect_y = $. Max. Y + ($. Max. Y-$. Min. Y)

Sel_effect_y
---- The above method is a method to obtain the coordinate of a vertex. In fact, it is to find an array from the position. In auto modify.
)

---- Negative direction of Y
(Axis_string = "Y -"):
(
-- Sel_effect_y _ = $. Pos
Sel_effect_y _ = $. Min. Y + ($. Min. Y-$. Max. Y)
Sel_effect_y _
)
---- Positive direction of Z
(Axis_string = "Z + "):
(
-- Sel_effect_z = $. Pos
Sel_effect_z = $. Max. Z + ($. Max. Z-$. Min. Z)
Sel_effect_z
)
-------- Negative Z direction
(Axis_string = "Z -"):
(
-- Sel_effect_z _ = $. Pos
Sel_effect_z _ = $. Min. Z + ($. Min. Z-$. Max. Z)
Sel_effect_z _
)
---- The positive direction of the X axis
(Axis_string = "x + "):
(
-- Sel_effect_x = $. Pos
Sel_effect_x = $. Max. x + ($. Max. X-$. Min. X)
Sel_effect_x
)
---- Negative direction of the X axis
(Axis_string = "X -"):
(
-- Sel_effect_x _ = $. Pos
Sel_effect_x _ = $. Min. x + ($. Min. X-$. Max. X)
Sel_effect_x _
)
----- After writing a function, you can easily call it,
) ---- End case
 
 
) --- End FN (coordinates of the collection piece .)

---- The function sel_effect_axis is a function that doubles the number of items that are used to create a patch,
----- I used the mouse to create a vertex. I just wanted to ask him to move it out of the axis.
Function sel_effect_axis_fold axis_string =
(
Case
(
(Axis_string = "Y + "):
(
-- Sel_effect_y = $. Pos

Sel_effect_y = $. Max. Y

Sel_effect_y
---- The above method is a method to obtain the coordinate of a vertex. In fact, it is to find an array from the position. In auto modify.
)

---- Negative direction of Y
(Axis_string = "Y -"):
(
-- Sel_effect_y _ = $. Pos
Sel_effect_y _ = $. Min. Y
Sel_effect_y _
)
---- Positive direction of Z
(Axis_string = "Z + "):
(
-- Sel_effect_z = $. Pos
Sel_effect_z = $. Max. Z
Sel_effect_z
)
-------- Negative Z direction
(Axis_string = "Z -"):
(
-- Sel_effect_z _ = $. Pos
Sel_effect_z _ = $. Min. Z
Sel_effect_z _
)
---- The positive direction of the X axis
(Axis_string = "x + "):
(
-- Sel_effect_x = $. Pos
Sel_effect_x = $. Max. x
Sel_effect_x
)
---- Negative direction of the X axis
(Axis_string = "X -"):
(
-- Sel_effect_x _ = $. Pos
Sel_effect_x _ = $. Min. x
Sel_effect_x _
)
----- After writing a function, you can easily call it,
) ---- End case
 
 
) --- End FN (coordinates of the collection piece .)

---- The following should be the mouse tool function. This is very important. You cannot simply use the mouse tool here.
--- Screen rays are required.

-- 1. When I click the corresponding Ray on the screen. The handed object has a coordinate, and then the number of coordinates is collected. Replace a number with the number corresponding to the function on the above axis.
-- 2. In this way, the number will be on a plane, and the plane data will be used to obtain the length and width, create a patch, and display the line in a positive mesh (the triangle should be stable .)

-- Mouseray = mapscreentoworldray mouse. pos -- here it should be the ray corresponding to the mouse Screen
-- Sectray = intersectray $ mouseray -- the return node is still the focus of the ray .)
--- It is the coordinates of the object pointed by the mouse, and there is a ray direction.
--- Create a mouse tool. If you need any function, write it on it.

--- Write a function to delete objects first
FN deleting_marker_sp =
(
If isdeleted sphere_s = true then
() Else
(
Delete sphere_s
)
)

FN mouse_tools_customize axis _ =
(
Global gt_kooc_in_form --- passed internally by the function I use, global
Gt_kooc_in_form = Axis _
Tool drawing __
(
On start do
(
--- Create a sphere in advance.
Sphere_s = sphere radius: 10 segs: 10 smooth: True colorbylayer: false wirecolor: red
Setsyscur # uscale
) --- End start
----- When you click the mouse
On mousepoint clickno do
(
Mouseray = mapscreentoworldray mouse. Pos
Try (sectray = intersectray $ mouseray) catch ()
If sectray = undefined then
(If isdeleted sphere_s = false then
Delete sphere_s --- this should be the end tool, but it cannot be written because I have to keep trying to click it.
-- Return false
) Else
(
--- In this example, the ball is being created, and production checks whether the variable is deleted and used in the mouse tool.
If isdeleted sphere_s = true then
(
Sphere_s = sphere radius: 10 segs: 10 smooth: True colorbylayer: false wirecolor: red
)
-- Sel_effect_axis_fold axis_string
--- Use a case
-- Ray_ra = sectray. Pos
-- Ray_ra [2] = sel_effect_axis_fold axis_string
-- Sphere_s.pos = ray_ra

Case gt_kooc_in_form
(
("Y + "):
(
Ray_ra = sectray. Pos
Ray_ra [2] = sel_effect_axis_fold "Y +"
Sphere_s.pos = ray_ra

) ---- End ()
("Y -"):
(
Ray_ra = sectray. Pos
Ray_ra [2] = sel_effect_axis_fold "Y -"
Sphere_s.pos = ray_ra

) ---- End ()
("Z + "):
(
Ray_ra = sectray. Pos
Ray_ra [3] = sel_effect_axis_fold "Z +"
Sphere_s.pos = ray_ra

) ---- End ()
("Z -"):
(
Ray_ra = sectray. Pos
Ray_ra [3] = sel_effect_axis_fold "Z -"
Sphere_s.pos = ray_ra


) ---- End ()
("X + "):
(
Ray_ra = sectray. Pos
Ray_ra [1] = sel_effect_axis_fold "x +"
Sphere_s.pos = ray_ra


) ---- End ()
("X -"):
(
Ray_ra = sectray. Pos
Ray_ra [1] = sel_effect_axis_fold "X -"
Sphere_s.pos = ray_ra

) ---- End ()

Default :()

) --- End case


)
--- Because the mouse tool Clicks Twice each time, it seems to be the first or three times. Therefore, a strong error reporting mechanism is added here.
--- Coordinates of points are implemented.

--- When I think of it, I feel that the direction is a little small and the effect is not very satisfactory.
--- Now I think it should be okay. I just select it on each axis.

) --- Create a ball to the box of the shape of the object. This is what I want to do,
 
On mousemove A do
(Sel_seltion = $ --- accumulate selected objects
Clearselection () ---- clear
Select sphere_s --- Select my previous ball
Maxops. clonenodes $ clonetype: # copy newnodes: & S2 --- make a copy
Clearselection () -- in the clear
Select sel_seltion --- the selected object before selection
Mouseray = mapscreentoworldray mouse. Pos
Try (sectray = intersectray $ mouseray) catch () --- Focus Point for the mouse,
If sectray = undefined then
(If isdeleted S2 = false then
Delete S2 --- this should be the end tool, but it cannot be written because I have to keep trying to click it.
-- Return false
) Else
(
If isdeleted S2 = true then
(
S2 = sphere radius: 10 segs: 10 smooth: True colorbylayer: false wirecolor: red
) ---- If S2 is deleted, re-create S2
Ray_ra = sectray. Pos
Sphere_s.pos = ray_ra
)


) --- End mousemove

---- It may take a while for a single free movement, because it is designed to move freely after one click or multiple clicks, or to move freely when it comes up.
On freemove do
(
--- I think I must copy the free movement. If I move the first one, the top point will be faulty, so this is very important.


) --- End freemove

On abort do
(

Deleting_marker_sp ()
)
On stop do
(

Deleting_marker_sp ()
)

)
--- The following is the start tool.
Starttool drawing __
 
) ---- End mouse_tools_customize

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.