Skip to content

Commit b314faa

Browse files
Added RPC server information.
1 parent 006977d commit b314faa

1 file changed

Lines changed: 57 additions & 1 deletion

File tree

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,62 @@ if INVENTOR_AVAILABLE:
175175
- Construction geometry
176176
- Solver status and DOF reporting
177177

178+
## RPC Server Mode
179+
180+
For GUI tools or external scripts that need to communicate with CAD applications, each adapter provides an RPC server/client pair.
181+
182+
### Starting Servers
183+
184+
**FreeCAD** (run in FreeCAD's Python console):
185+
```python
186+
from morphe.adapters.freecad import start_server
187+
start_server() # localhost:9876
188+
```
189+
190+
**Fusion 360** (install the MorpheServer add-in from `morphe/adapters/fusion/addin/MorpheServer/`):
191+
```bash
192+
cd morphe/adapters/fusion/addin
193+
python setup_addin.py install
194+
```
195+
The server starts automatically when Fusion 360 launches (localhost:9879).
196+
197+
**SolidWorks** (run with SolidWorks open):
198+
```python
199+
from morphe.adapters.solidworks import start_server
200+
start_server() # localhost:9878
201+
```
202+
203+
**Inventor** (run with Inventor open):
204+
```python
205+
from morphe.adapters.inventor import start_server
206+
start_server() # localhost:9877
207+
```
208+
209+
### Using Clients
210+
211+
All clients share the same interface:
212+
213+
```python
214+
from morphe.adapters.freecad import FreeCADClient
215+
# or: from morphe.adapters.fusion import FusionClient
216+
# or: from morphe.adapters.solidworks import SolidWorksClient
217+
# or: from morphe.adapters.inventor import InventorClient
218+
219+
client = FreeCADClient()
220+
if client.connect():
221+
# List available sketches
222+
sketches = client.list_sketches()
223+
224+
# Export a sketch to canonical format
225+
sketch = client.export_sketch("Sketch")
226+
227+
# Import a sketch into the CAD application
228+
client.import_sketch(my_sketch, name="NewSketch")
229+
230+
# Get solver status
231+
status, dof = client.get_solver_status("Sketch")
232+
```
233+
178234
## Running Tests
179235

180236
**Core tests (no CAD software required):**
@@ -193,7 +249,7 @@ pytest tests/test_freecad_roundtrip.py -v
193249
The Fusion 360 test suite (73 tests) must be run as a script inside Fusion 360:
194250
1. Open Fusion 360
195251
2. Go to Utilities > Add-Ins > Scripts
196-
3. Add and run the test script from `adapter_fusion/script/MorpheTests/`
252+
3. Add and run the test script from `morphe/adapters/fusion/script/MorpheTests/`
197253

198254
**SolidWorks adapter tests (requires SolidWorks on Windows):**
199255
```bash

0 commit comments

Comments
 (0)