rhinomcp 0.1.1.3__tar.gz → 0.1.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/PKG-INFO +1 -1
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/pyproject.toml +1 -1
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/__init__.py +1 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/create_object.py +24 -13
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/create_objects.py +32 -3
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/delete_object.py +11 -2
- rhinomcp-0.1.1.4/src/rhinomcp/tools/modify_objects.py +45 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp.egg-info/PKG-INFO +1 -1
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp.egg-info/SOURCES.txt +2 -1
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/README.md +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/setup.cfg +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/prompts/assert_creation_strategy.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/prompts/assert_query_strategy.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/server.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/execute_rhinoscript_python_code.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/get_document_info.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/get_object_info.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/get_selected_objects_info.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp/tools/modify_object.py +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp.egg-info/dependency_links.txt +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp.egg-info/entry_points.txt +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp.egg-info/requires.txt +0 -0
- {rhinomcp-0.1.1.3 → rhinomcp-0.1.1.4}/src/rhinomcp.egg-info/top_level.txt +0 -0
@@ -15,5 +15,6 @@ from .tools.get_document_info import get_document_info
|
|
15
15
|
from .tools.get_object_info import get_object_info
|
16
16
|
from .tools.get_selected_objects_info import get_selected_objects_info
|
17
17
|
from .tools.modify_object import modify_object
|
18
|
+
from .tools.modify_objects import modify_objects
|
18
19
|
from .tools.execute_rhinoscript_python_code import execute_rhinoscript_python_code
|
19
20
|
|
@@ -18,7 +18,7 @@ def create_object(
|
|
18
18
|
Create a new object in the Rhino document.
|
19
19
|
|
20
20
|
Parameters:
|
21
|
-
- type: Object type ("BOX", "SPHERE")
|
21
|
+
- type: Object type ("POINT", "LINE", "POLYLINE", "CURVE", "BOX", "SPHERE")
|
22
22
|
- name: Optional name for the object
|
23
23
|
- color: Optional [r, g, b] color values (0-255) for the object
|
24
24
|
- params: Type-specific parameters dictionary (see documentation for each type)
|
@@ -27,15 +27,35 @@ def create_object(
|
|
27
27
|
- scale: Optional [x, y, z] scale factors
|
28
28
|
|
29
29
|
The params dictionary is type-specific.
|
30
|
+
For POINT, the params dictionary should be empty.
|
31
|
+
|
32
|
+
For LINE, the params dictionary should contain the following keys:
|
33
|
+
- start: [x, y, z] start point of the line
|
34
|
+
- end: [x, y, z] end point of the line
|
35
|
+
|
36
|
+
For POLYLINE, the params dictionary should contain the following keys:
|
37
|
+
- points: List of [x, y, z] points that define the polyline
|
38
|
+
|
39
|
+
For CURVE, the params dictionary should contain the following keys:
|
40
|
+
- points: List of [x, y, z] control points that define the curve
|
41
|
+
- degree: Degree of the curve (default is 3, if user asked for smoother curve, degree can be higher)
|
42
|
+
|
30
43
|
For BOX, the params dictionary should contain the following keys:
|
31
44
|
- width: Width of the box along X axis of the object
|
32
45
|
- length: Length of the box along Y axis of the object
|
33
46
|
- height: Height of the box along Z axis of the object
|
47
|
+
|
48
|
+
For SPHERE, the params dictionary should contain the following key:
|
49
|
+
- radius: Radius of the sphere
|
34
50
|
|
35
51
|
Returns:
|
36
52
|
A message indicating the created object name.
|
37
53
|
|
38
54
|
Examples of params:
|
55
|
+
- POINT: {} (no additional parameters because the point location is defined by the translation vector)
|
56
|
+
- LINE: {"start": [0, 0, 0], "end": [1, 1, 1]}
|
57
|
+
- POLYLINE: {"points": [[0, 0, 0], [1, 1, 1], [2, 2, 2]]}
|
58
|
+
- CURVE: {"points": [[0, 0, 0], [1, 1, 1], [2, 2, 2]], "degree": 3}
|
39
59
|
- BOX: {"width": 1.0, "length": 1.0, "height": 1.0}
|
40
60
|
- SPHERE: {"radius": 1.0}
|
41
61
|
"""
|
@@ -51,24 +71,15 @@ def create_object(
|
|
51
71
|
"type": type,
|
52
72
|
"translation": trans,
|
53
73
|
"rotation": rot,
|
54
|
-
"scale": sc
|
74
|
+
"scale": sc,
|
75
|
+
"params": params
|
55
76
|
}
|
56
77
|
|
57
78
|
if name: command_params["name"] = name
|
58
79
|
if color: command_params["color"] = color
|
59
80
|
|
60
81
|
# Create the object
|
61
|
-
result =
|
62
|
-
if (type == "BOX"):
|
63
|
-
command_params["width"] = params["width"]
|
64
|
-
command_params["length"] = params["length"]
|
65
|
-
command_params["height"] = params["height"]
|
66
|
-
result = rhino.send_command("create_object", command_params)
|
67
|
-
elif (type == "SPHERE"):
|
68
|
-
result = rhino.send_command("create_object", command_params)
|
69
|
-
# elif (type == "CYLINDER"):
|
70
|
-
# result = rhino.send_command("create_cylinder", command_params)
|
71
|
-
|
82
|
+
result = result = rhino.send_command("create_object", command_params)
|
72
83
|
|
73
84
|
return f"Created {type} object: {result['name']}"
|
74
85
|
except Exception as e:
|
@@ -15,11 +15,11 @@ def create_objects(
|
|
15
15
|
Parameters:
|
16
16
|
- objects: A list of dictionaries, each containing the parameters for a single object
|
17
17
|
|
18
|
-
Each object should have the following
|
19
|
-
- type: Object type ("BOX")
|
18
|
+
Each object should have the following values:
|
19
|
+
- type: Object type ("POINT", "LINE", "POLYLINE", "BOX", "SPHERE", etc.)
|
20
20
|
- name: Optional name for the object
|
21
21
|
- color: Optional [r, g, b] color values (0-255) for the object
|
22
|
-
- params: Type-specific parameters dictionary (see documentation for each type)
|
22
|
+
- params: Type-specific parameters dictionary (see documentation for each type in create_object() function)
|
23
23
|
- translation: Optional [x, y, z] translation vector
|
24
24
|
- rotation: Optional [x, y, z] rotation in radians
|
25
25
|
- scale: Optional [x, y, z] scale factors
|
@@ -29,6 +29,26 @@ def create_objects(
|
|
29
29
|
|
30
30
|
Examples of params:
|
31
31
|
[
|
32
|
+
{
|
33
|
+
"type": "POINT",
|
34
|
+
"name": "Point 1",
|
35
|
+
"translation": [0, 0, 0]
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"type": "LINE",
|
39
|
+
"name": "Line 1",
|
40
|
+
"params": {"start": [0, 0, 0], "end": [1, 1, 1]}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"type": "POLYLINE",
|
44
|
+
"name": "Polyline 1",
|
45
|
+
"params": {"points": [[0, 0, 0], [1, 1, 1], [2, 2, 2]]}
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"type": "CURVE",
|
49
|
+
"name": "Curve 1",
|
50
|
+
"params": {"points": [[0, 0, 0], [1, 1, 1], [2, 2, 2]], "degree": 3}
|
51
|
+
},
|
32
52
|
{
|
33
53
|
"type": "BOX",
|
34
54
|
"name": "Box 1",
|
@@ -37,6 +57,15 @@ def create_objects(
|
|
37
57
|
"translation": [0, 0, 0],
|
38
58
|
"rotation": [0, 0, 0],
|
39
59
|
"scale": [1, 1, 1]
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"type": "SPHERE",
|
63
|
+
"name": "Sphere 1",
|
64
|
+
"color": [0, 255, 0],
|
65
|
+
"params": {"radius": 1.0},
|
66
|
+
"translation": [0, 0, 0],
|
67
|
+
"rotation": [0, 0, 0],
|
68
|
+
"scale": [1, 1, 1]
|
40
69
|
}
|
41
70
|
]
|
42
71
|
"""
|
@@ -6,7 +6,7 @@ from typing import Any, List, Dict
|
|
6
6
|
|
7
7
|
|
8
8
|
@mcp.tool()
|
9
|
-
def delete_object(ctx: Context, id: str = None, name: str = None) -> str:
|
9
|
+
def delete_object(ctx: Context, id: str = None, name: str = None, all: bool = None) -> str:
|
10
10
|
"""
|
11
11
|
Delete an object from the Rhino document.
|
12
12
|
|
@@ -17,8 +17,17 @@ def delete_object(ctx: Context, id: str = None, name: str = None) -> str:
|
|
17
17
|
try:
|
18
18
|
# Get the global connection
|
19
19
|
rhino = get_rhino_connection()
|
20
|
+
|
21
|
+
commandParams = {}
|
22
|
+
if id is not None:
|
23
|
+
commandParams["id"] = id
|
24
|
+
if name is not None:
|
25
|
+
commandParams["name"] = name
|
26
|
+
if all:
|
27
|
+
commandParams["all"] = all
|
20
28
|
|
21
|
-
result = rhino.send_command("delete_object",
|
29
|
+
result = rhino.send_command("delete_object", commandParams)
|
30
|
+
|
22
31
|
return f"Deleted object: {result['name']}"
|
23
32
|
except Exception as e:
|
24
33
|
logger.error(f"Error deleting object: {str(e)}")
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from mcp.server.fastmcp import Context
|
2
|
+
import json
|
3
|
+
from rhinomcp.server import get_rhino_connection, mcp, logger
|
4
|
+
from typing import Any, List, Dict
|
5
|
+
|
6
|
+
|
7
|
+
@mcp.tool()
|
8
|
+
def modify_objects(
|
9
|
+
ctx: Context,
|
10
|
+
objects: List[Dict[str, Any]],
|
11
|
+
all: bool = None
|
12
|
+
) -> str:
|
13
|
+
"""
|
14
|
+
Create multiple objects at once in the Rhino document.
|
15
|
+
|
16
|
+
Parameters:
|
17
|
+
- objects: A List of objects, each containing the parameters for a single object modification
|
18
|
+
- all: Optional boolean to modify all objects, if true, only one object is required in the objects dictionary
|
19
|
+
|
20
|
+
Each object can have the following parameters:
|
21
|
+
- id: The id of the object to modify
|
22
|
+
- new_color: Optional [r, g, b] color values (0-255) for the object
|
23
|
+
- translation: Optional [x, y, z] translation vector
|
24
|
+
- rotation: Optional [x, y, z] rotation in radians
|
25
|
+
- scale: Optional [x, y, z] scale factors
|
26
|
+
- visible: Optional boolean to set visibility
|
27
|
+
|
28
|
+
Returns:
|
29
|
+
A message indicating the modified objects.
|
30
|
+
"""
|
31
|
+
try:
|
32
|
+
# Get the global connection
|
33
|
+
rhino = get_rhino_connection()
|
34
|
+
command_params = {}
|
35
|
+
command_params["objects"] = objects
|
36
|
+
if all:
|
37
|
+
command_params["all"] = all
|
38
|
+
result = rhino.send_command("modify_objects", command_params)
|
39
|
+
|
40
|
+
|
41
|
+
return f"Modified {result['modified']} objects"
|
42
|
+
except Exception as e:
|
43
|
+
logger.error(f"Error modifying objects: {str(e)}")
|
44
|
+
return f"Error modifying objects: {str(e)}"
|
45
|
+
|
@@ -17,4 +17,5 @@ src/rhinomcp/tools/execute_rhinoscript_python_code.py
|
|
17
17
|
src/rhinomcp/tools/get_document_info.py
|
18
18
|
src/rhinomcp/tools/get_object_info.py
|
19
19
|
src/rhinomcp/tools/get_selected_objects_info.py
|
20
|
-
src/rhinomcp/tools/modify_object.py
|
20
|
+
src/rhinomcp/tools/modify_object.py
|
21
|
+
src/rhinomcp/tools/modify_objects.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|