rhinomcp 0.1.1.3__py3-none-any.whl → 0.1.1.4__py3-none-any.whl

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/__init__.py CHANGED
@@ -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 keys:
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", {"id": id, "name": name})
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
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rhinomcp
3
- Version: 0.1.1.3
3
+ Version: 0.1.1.4
4
4
  Summary: Rhino integration through the Model Context Protocol
5
5
  Author-email: Jingcheng Chen <mail@jchen.ch>
6
6
  License: MIT
@@ -1,17 +1,18 @@
1
- rhinomcp/__init__.py,sha256=pMvTrNAVPMY408zklG_Cln9YsIH4_yCT52aS4JIXNy4,797
1
+ rhinomcp/__init__.py,sha256=-jyyqgZeUIMuJyDHKw6Yu7sEjo5nhA6ZVYJWtcB0VU4,846
2
2
  rhinomcp/server.py,sha256=G4ESexAfPZOCzIVYCbg51aMnJa-Zw6aOtZm1w2_6Ogc,9499
3
3
  rhinomcp/prompts/assert_creation_strategy.py,sha256=KryUyOnDZAPK9Syr31hkStCFsqJIRJRI2lkToK03aeo,1255
4
4
  rhinomcp/prompts/assert_query_strategy.py,sha256=fFOZFv6zUE-tw6HaTBIhM5A96zeBpinN1tYKwbz0C1o,379
5
- rhinomcp/tools/create_object.py,sha256=O-jfh28UoDulp3r9PJEEVS1B-L3adJzws0Z_wYXgEHw,2616
6
- rhinomcp/tools/create_objects.py,sha256=8iPTM8559J-9IQql2VGoem7CaqMIaylXmXk-FNRLv8A,1696
7
- rhinomcp/tools/delete_object.py,sha256=Opd2FInqZKIxlD8Qi4Q-OpfI7Y9aHWdYmNNjtA99xB4,762
5
+ rhinomcp/tools/create_object.py,sha256=nsNOeDAheOQQmnUR10Oqji6pAt9cvLQ67SdUHE08M-o,3248
6
+ rhinomcp/tools/create_objects.py,sha256=D_3wREnM4cJ2FO2RCTkGtE5gLmVyMWjY44ClSRZO-TA,2606
7
+ rhinomcp/tools/delete_object.py,sha256=-Vz1AZlw0-hPQZ9wNVTpa5sRDJ2qLiDnfjSYKp2wafc,987
8
8
  rhinomcp/tools/execute_rhinoscript_python_code.py,sha256=7bveKWTxTJ8_9Gcelied4dEQjyd2WeNV-4iTL1i-prs,1837
9
9
  rhinomcp/tools/get_document_info.py,sha256=poPyqfO0KeV5Au3jks9Q3o6tTZVDfEuCm9BZWCLfpqY,613
10
10
  rhinomcp/tools/get_object_info.py,sha256=mqsnkVzYHMnv9CPA7DX1dyj5z538WEsIVWu9yI6DChM,967
11
11
  rhinomcp/tools/get_selected_objects_info.py,sha256=73u2Y9l9O8rwboFwBcfGQFYuFBZBp1UkChNJkK2Rbjo,573
12
12
  rhinomcp/tools/modify_object.py,sha256=OVQa75PAmuVx-YslxSC2ITdFbp6cCELVaacI77sJ7Zg,1912
13
- rhinomcp-0.1.1.3.dist-info/METADATA,sha256=aYor-cdRbb5gs9qdJn7aj9PLvtxNG1MK5iKY0BYKXSE,920
14
- rhinomcp-0.1.1.3.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
15
- rhinomcp-0.1.1.3.dist-info/entry_points.txt,sha256=OserOidtKWCl-_h3O1c2e9La6wYmJ9rE5F_T5wRLX9w,50
16
- rhinomcp-0.1.1.3.dist-info/top_level.txt,sha256=sw73qoWC7GQp5upujkME6pRWc8OxBydEeDwQqu-qv4U,9
17
- rhinomcp-0.1.1.3.dist-info/RECORD,,
13
+ rhinomcp/tools/modify_objects.py,sha256=52okeGwV5IQiuBSBH9HcyDCxWbCNF4eA7LoLuhLlgp4,1498
14
+ rhinomcp-0.1.1.4.dist-info/METADATA,sha256=dTwOlFJ6zTO7Ucn3ikoMS4rf6TGIsXFZQ4JVJhmkpAk,920
15
+ rhinomcp-0.1.1.4.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
16
+ rhinomcp-0.1.1.4.dist-info/entry_points.txt,sha256=OserOidtKWCl-_h3O1c2e9La6wYmJ9rE5F_T5wRLX9w,50
17
+ rhinomcp-0.1.1.4.dist-info/top_level.txt,sha256=sw73qoWC7GQp5upujkME6pRWc8OxBydEeDwQqu-qv4U,9
18
+ rhinomcp-0.1.1.4.dist-info/RECORD,,