### Install easyeda2kicad via pip Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Standard installation command for systems with Python installed. ```bash pip install easyeda2kicad ``` -------------------------------- ### Install Package in Develop Mode Source: https://github.com/upesy/easyeda2kicad.py/blob/master/CONTRIBUTING.md Install the package in development mode using setup.py. This allows for direct code changes and testing. ```bash python setup.py develop ``` -------------------------------- ### PAD Command Example Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_FOOTPRINT.md Example of a PAD command for defining a footprint pad. Ensure correct field order and values for shape, dimensions, layer, and other properties. ```text PAD~RECT~3994.299~2995~9.0551~9.0551~11~~1~2.7559~3989.7715 2990.4725 3998.8266 2990.4725 3998.8266 2999.5276 3989.7715 2999.5276~0~gge118~0~~Y~0~0~0.19685~3994.299,2995 ``` -------------------------------- ### Pin Command Example Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md A concrete example of a pin definition string as it appears in EasyEDA symbol data. ```text P~show~0~1~350~310~180~gge6~0^^350~310^^M 350 310 h 10~#000000^^1~363.7~314~0~VSS~start~~~#000000^^1~359.5~309~0~1~end~~~#000000^^0~357~310^^0~M 360 313 L 363 310 L 360 307 ``` -------------------------------- ### Install easyeda2kicad on macOS Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Installation command specifically for the Python interpreter bundled with KiCad on macOS. ```bash /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python3 -m pip install easyeda2kicad ``` -------------------------------- ### Generate Reference Files Source: https://github.com/upesy/easyeda2kicad.py/blob/master/tests/README.md Install development dependencies and generate initial reference files for regression testing. ```bash pip install .[dev] pytest tests/test_regression.py --create-reference -v ``` -------------------------------- ### Bash: Generate Component and Configure KiCad Libraries Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Command-line examples for generating component files and configuring KiCad to use them. The first command generates symbol and footprint. The subsequent steps detail how to add these generated libraries to KiCad's global library management. For project-specific libraries with portable 3D paths, use the `--project-relative` flag. ```bash # Generate a component first easyeda2kicad --symbol --footprint --lcsc_id=C2040 # KiCad Configuration: # 1. Go to Preferences > Configure Paths # Add: EASYEDA2KICAD = /home/username/Documents/Kicad/easyeda2kicad/ # # 2. Go to Preferences > Manage Symbol Libraries # Add global library: easyeda2kicad # Path: ${EASYEDA2KICAD}/easyeda2kicad.kicad_sym # # 3. Go to Preferences > Manage Footprint Libraries # Add global library: easyeda2kicad # Path: ${EASYEDA2KICAD}/easyeda2kicad.pretty # For project-specific libraries with portable 3D paths: easyeda2kicad --full --lcsc_id=C2040 \ --output ~/myproject/libs/project_lib \ --project-relative # This stores 3D paths as ${KIPRJMOD}/libs/project_lib.3dshapes/... ``` -------------------------------- ### Example Rectangle (Format 2) Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md An example of a rectangle definition using Format 2, including rounded corners. ```text R~360~298~2~2~80~34~#880000~1~0~none~gge4~0~ ``` -------------------------------- ### Pin Number Extraction Example Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md A snippet demonstrating the extraction of the pin number from the fourth segment of the pin command string. ```text 1~359.5~309~0~1~end ``` -------------------------------- ### Example Circle Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md An example of a circle definition, specifying its center, radius, and appearance. ```text C~400~300~5~#880000~1~0~none~gge10~0 ``` -------------------------------- ### Example Ellipse Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md An example of an ellipse definition, specifying its center, radii, and appearance. ```text E~365~303~1.5~1.5~#880000~1~0~#880000~gge3~0 ``` -------------------------------- ### Python: Complete Component Conversion Pipeline Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Use this Python script to programmatically convert an LCSC component into KiCad symbol, footprint, and 3D model files. It fetches component data, imports it using dedicated importers, and exports it using KiCad exporters. Ensure the `easyeda2kicad` library is installed. ```python from pathlib import Path from easyeda2kicad import ( EasyedaApi, EasyedaSymbolImporter, EasyedaFootprintImporter, Easyeda3dModelImporter, ExporterSymbolKicad, ExporterFootprintKicad, Exporter3dModelKicad ) def convert_component(lcsc_id: str, output_path: str): """Convert an LCSC component to KiCad library files.""" api = EasyedaApi(use_cache=True) # Fetch component data cad_data = api.get_cad_data_of_component(lcsc_id=lcsc_id) if not cad_data: raise ValueError(f"Component {lcsc_id} not found") lib_name = Path(output_path).stem # Convert symbol ee_symbol = EasyedaSymbolImporter(easyeda_cp_cad_data=cad_data).get_symbol() sym_exporter = ExporterSymbolKicad( symbol=ee_symbol, custom_fields={"LCSC": lcsc_id} ) sym_exporter.save_to_lib( lib_path=f"{output_path}.kicad_sym", footprint_lib_name=lib_name, overwrite=True ) print(f"Symbol saved: {output_path}.kicad_sym") # Convert footprint ee_footprint = EasyedaFootprintImporter(easyeda_cp_cad_data=cad_data).get_footprint() fp_exporter = ExporterFootprintKicad(footprint=ee_footprint) fp_path = Path(f"{output_path}.pretty") fp_path.mkdir(parents=True, exist_ok=True) fp_exporter.export( footprint_full_path=str(fp_path / f"{ee_footprint.info.name}.kicad_mod"), model_3d_path=f"{output_path}.3dshapes" ) print(f"Footprint saved: {fp_path / ee_footprint.info.name}.kicad_mod") # Convert 3D model model_importer = Easyeda3dModelImporter( easyeda_cp_cad_data=cad_data, download_raw_3d_model=True, api=api ) if model_importer.output: model_exporter = Exporter3dModelKicad(model_3d=model_importer.output) model_exporter.export( output_dir=f"{output_path}.3dshapes", overwrite=True ) print(f"3D model saved: {output_path}.3dshapes/") return ee_symbol.info.name # Usage component_name = convert_component("C2040", "~/Documents/Kicad/mylib/mylib") print(f"Converted: {component_name}") ``` -------------------------------- ### VRML Output Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Example structure for a VRML 2.0 IndexedFaceSet node, used for KiCad visualization. Note the 0-based indexing for coordinates and the '-1' face delimiter. ```vrml #VRML V2.0 utf8 Shape { appearance Appearance { material Material { diffuseColor 0.8 0.8 0.8 specularColor 0.5 0.5 0.5 ambientIntensity 0.2 transparency 0 shininess 0.5 } } geometry IndexedFaceSet { ccw TRUE solid FALSE coord Coordinate { point [ 1.0 2.0 3.0, 2.0 3.0 4.0, ... ] } coordIndex [ 0, 1, 2, -1, 1, 2, 3, -1, ... ] } } ``` -------------------------------- ### Get Pre-rendered SVGs from API Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Fetch pre-rendered SVG data for both the symbol and footprint of a component directly from the EasyEDA API. ```python # Get pre-rendered SVGs from EasyEDA API svg_data = api.get_svg_from_api(lcsc_id="C2040") # Returns: {'symbol': '...', 'footprint': '...'} ``` -------------------------------- ### OBJ to WRL Coordinate Conversion Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Converts millimeters (OBJ) to inches (WRL) for VRML compatibility. Divide millimeter values by 25.4 to get inch values. ```python inch = mm / 25.4 ``` -------------------------------- ### Generate initial library files Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Run the script to generate the necessary library files before configuring them in KiCad. ```bash easyeda2kicad --symbol --footprint --lcsc_id=C2040 ``` -------------------------------- ### Run easyeda2kicad commands Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Various command-line options for converting components, including full conversion, individual parts, and custom output paths. ```bash # Symbol + footprint + 3D model easyeda2kicad --full --lcsc_id=C2040 # Individual parts easyeda2kicad --symbol --lcsc_id=C2040 easyeda2kicad --footprint --lcsc_id=C2040 easyeda2kicad --3d --lcsc_id=C2040 # Multiple components at once easyeda2kicad --full --lcsc_id C2040 C20197 C163691 # Custom output path easyeda2kicad --full --lcsc_id=C2040 --output ~/libs/my_lib # SVG preview (no KiCad conversion) easyeda2kicad --svg --lcsc_id=C2040 --output ~/libs/my_lib ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/upesy/easyeda2kicad.py/blob/master/CONTRIBUTING.md Create a Python virtual environment named 'env' and activate it. This isolates project dependencies. ```bash python -m venv env source env/bin/activate ``` -------------------------------- ### Configure Git LFS for References Source: https://github.com/upesy/easyeda2kicad.py/blob/master/tests/README.md Initialize Git LFS to track large binary reference files in the repository. ```bash git lfs install git lfs track "tests/reference_outputs/**" git add .gitattributes pytest tests/test_regression.py --create-reference -v git add tests/reference_outputs/ git commit -m "test: add regression reference files via Git LFS" git push ``` -------------------------------- ### Get Raw API Response Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Obtain the raw response from the EasyEDA API, which includes a success status and metadata along with the component data. ```python # Get raw API response (includes success status and metadata) api_response = api.get_info_from_easyeda_api(lcsc_id="C2040") # Returns: {'success': True, 'result': {...component_data...}} ``` -------------------------------- ### Initialize EasyedaApi with Caching Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Instantiate the EasyedaApi class, optionally enabling response caching for faster subsequent requests. ```python from easyeda2kicad import EasyedaApi api = EasyedaApi(use_cache=True) ``` -------------------------------- ### OBJ Vertices Definition Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Specifies the 3D coordinates for each vertex in an OBJ model. Each line starts with 'v' followed by X, Y, and Z values. ```obj v 1.234 5.678 9.012 v 2.345 6.789 0.123 ``` -------------------------------- ### EasyEDA Footprint Commands Overview Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_FOOTPRINT.md Provides a summary of available EasyEDA footprint shape commands and their implementation status. ```APIDOC ## Command Overview ### Description Lists all available EasyEDA footprint shape commands and their implementation status. ### Method None (Data definition format) ### Endpoint None (Data definition format) ### Parameters None ### Request Example None ### Response #### Success Response (200) Provides a table of commands and their descriptions. #### Response Example ``` | Command | Description | Implementation | |-------------|---------------------------------------|----------------| | PAD | Footprint pad (SMD or through-hole) | ✅ Implemented | | TRACK | Copper track/trace or silkscreen line | ✅ Implemented | | RECT | Rectangle shape | ✅ Implemented | | CIRCLE | Circle shape | ✅ Implemented | | HOLE | Non-plated hole | ✅ Implemented | | VIA | Via connection | ✅ Implemented | | ARC | Arc segment | ✅ Implemented | | TEXT | Text label | ✅ Implemented | | SOLIDREGION | Filled polygon region | ✅ Implemented | | SVGNODE | 3D model metadata (JSON) | ✅ Implemented | ``` ``` -------------------------------- ### Convert Full Component (Symbol + Footprint + 3D Model) Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Converts a complete component including its symbol, footprint, and 3D model using its LCSC ID. Specify the output directory with --output. ```bash easyeda2kicad --full --lcsc_id=C2040 ``` -------------------------------- ### Download Raw 3D Model Files Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Download the raw OBJ or STEP 3D model files for a component using its unique UUID. Returns None if the model is not found. ```python # Download raw 3D model files uuid = "43ba165dae7e4f5b88ae140d98d63cbd" obj_data = api.get_raw_3d_model_obj(uuid=uuid) # Returns OBJ text or None step_data = api.get_step_3d_model(uuid=uuid) # Returns STEP bytes or None ``` -------------------------------- ### Fetch and Import EasyEDA Symbol Data Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Demonstrates fetching component data using EasyedaApi and then initializing EasyedaSymbolImporter to parse the symbol information. ```python from easyeda2kicad import EasyedaApi, EasyedaSymbolImporter # Fetch component data api = EasyedaApi() cad_data = api.get_cad_data_of_component(lcsc_id="C2040") ``` -------------------------------- ### Clone and Update Repository Source: https://github.com/upesy/easyeda2kicad.py/blob/master/CONTRIBUTING.md Clone your forked repository, set up the upstream remote, and fetch/merge changes from the upstream dev branch. Ensure PRs are made against the dev branch. ```bash git clone https://github.com/YOUR-USERNAME/easyeda2kicad.py.git cd easyeda2kicad.py git remote add upstream https://github.com/uPesy/easyeda2kicad.py.git git fetch upstream git merge upstream/dev git pull origin dev ``` -------------------------------- ### KiCad 3D Model File Structure Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Illustrates the expected directory structure for KiCad footprints and their associated 3D models. WRL files are converted from OBJ, and STEP files are passed through. ```directory MyLibrary.pretty/ └── Footprint.kicad_mod MyLibrary.3dshapes/ ├── IND-SMD_L7.0-W6.6-H3.0.wrl # VRML (converted from OBJ) └── IND-SMD_L7.0-W6.6-H3.0.step # STEP (binary pass-through) ``` -------------------------------- ### KiCad Footprint Integration Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Demonstrates how to reference VRML and STEP 3D models within a KiCad footprint file and the expected directory structure. ```APIDOC ## KiCad Footprint Integration ### Model Reference Specifies how to include 3D model references in the `.kicad_mod` file for both VRML and STEP formats. ```kicad_mod (model "${EASYEDA2KICAD}/IND-SMD_L7.0-W6.6-H3.0.wrl" (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) ) (model "${EASYEDA2KICAD}/IND-SMD_L7.0-W6.6-H3.0.step" (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) ) ``` ### File Structure Illustrates the recommended directory layout for KiCad libraries and their associated 3D models. ``` MyLibrary.pretty/ └── Footprint.kicad_mod MyLibrary.3dshapes/ ├── IND-SMD_L7.0-W6.6-H3.0.wrl # VRML (converted from OBJ) └── IND-SMD_L7.0-W6.6-H3.0.step # STEP (binary pass-through) ``` ``` -------------------------------- ### Import multiple components Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Processes multiple LCSC IDs in a single command execution. ```bash easyeda2kicad --full --lcsc_id C2040 C20197 C163691 ``` -------------------------------- ### Extract EasyEDA Footprint Data Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Shows how to fetch component data and extract footprint geometry, pad details, and 3D model metadata. ```python from easyeda2kicad import EasyedaApi, EasyedaFootprintImporter # Fetch component data api = EasyedaApi() cad_data = api.get_cad_data_of_component(lcsc_id="C2040") # Import footprint data importer = EasyedaFootprintImporter(easyeda_cp_cad_data=cad_data) ee_footprint = importer.get_footprint() # Access footprint information print(f"Name: {ee_footprint.info.name}") # e.g., "SOIC-8_L5.0-W4.0-P1.27" print(f"Type: {ee_footprint.info.fp_type}") # "smd" or "tht" print(f"3D Model: {ee_footprint.info.model_3d_name}") print(f"LCSC ID: {ee_footprint.info.lcsc_id}") # Access footprint geometry print(f"Pads: {len(ee_footprint.pads)}") print(f"Tracks: {len(ee_footprint.tracks)}") print(f"Holes: {len(ee_footprint.holes)}") print(f"Vias: {len(ee_footprint.vias)}") print(f"Circles: {len(ee_footprint.circles)}") print(f"Arcs: {len(ee_footprint.arcs)}") print(f"Rectangles: {len(ee_footprint.rectangles)}") print(f"Texts: {len(ee_footprint.texts)}") print(f"Solid regions: {len(ee_footprint.solid_regions)}") # Access pad details for pad in ee_footprint.pads: print(f"Pad {pad.number}: shape={pad.shape}") print(f" Center: ({pad.center_x}, {pad.center_y})") print(f" Size: {pad.width} x {pad.height}") print(f" Hole radius: {pad.hole_radius}") # 0 for SMD print(f" Layer: {pad.layer_id}") print(f" Rotation: {pad.rotation}") # Access embedded 3D model metadata (if present) if ee_footprint.model_3d: print(f"3D Model UUID: {ee_footprint.model_3d.uuid}") print(f"3D Model Name: {ee_footprint.model_3d.name}") print(f"Translation: ({ee_footprint.model_3d.translation.x}, " f"{ee_footprint.model_3d.translation.y}, " f"{ee_footprint.model_3d.translation.z})") print(f"Rotation: ({ee_footprint.model_3d.rotation.x}, " f"{ee_footprint.model_3d.rotation.y}, " f"{ee_footprint.model_3d.rotation.z})") ``` -------------------------------- ### EasyEDA STEP Download Endpoint Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Use this endpoint to download 3D models in STEP format. These are binary CAD files passed through unchanged. Note the specific bucket ID in the URL. ```http https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y/{uuid} ``` -------------------------------- ### Enable caching and debug mode Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Use --use-cache to store API responses locally and --debug to enable verbose logging. ```bash easyeda2kicad --full --lcsc_id=C2040 --use-cache --debug ``` -------------------------------- ### Specify custom output library path Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Directs the tool to save symbols, footprints, and 3D models to a specific directory. ```bash easyeda2kicad --full --lcsc_id=C2040 --output ~/libs/my_lib ``` -------------------------------- ### Run Regression Tests Source: https://github.com/upesy/easyeda2kicad.py/blob/master/tests/README.md Execute the test suite to verify generated files against existing references. ```bash pytest tests/ -v ``` -------------------------------- ### Export SVG Preview Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Export SVG previews of the symbol and footprint without performing KiCad conversion. Useful for quick visualization. ```bash easyeda2kicad --svg --lcsc_id=C2040 --output ~/libs/my_lib ``` -------------------------------- ### Configure proxy server Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Set the HTTPS_PROXY environment variable to route API requests through a proxy server. ```bash # Linux / macOS HTTPS_PROXY=http://proxy.example.com:8080 easyeda2kicad --full --lcsc_id=C2040 # Windows set HTTPS_PROXY=http://proxy.example.com:8080 && easyeda2kicad --full --lcsc_id=C2040 ``` -------------------------------- ### EasyEDA Polygon Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md Use the 'PG' command to define a polygon. Specify points, stroke color, width, style, fill color, ID, and lock status. Points are space-separated coordinates. ```text PG~points~stroke_color~stroke_width~stroke_style~fill_color~id~locked ``` ```text PG~380 290 390 290 390 310 380 310~#880000~1~0~#880000~gge9~0 ``` -------------------------------- ### Update Reference Files Source: https://github.com/upesy/easyeda2kicad.py/blob/master/tests/README.md Clear existing references and regenerate them when output changes are intentional. ```bash rm -rf tests/reference_outputs/ pytest tests/test_regression.py --create-reference -v ``` -------------------------------- ### Enable Debug Caching Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Enables local caching for faster re-conversion of 3D models by setting the logging level to DEBUG. Cached files are stored in the '.easyeda_cache/' directory. ```python import logging logging.basicConfig(level=logging.DEBUG) ``` -------------------------------- ### Use project-relative 3D model paths Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Stores 3D model paths relative to the project root using the ${KIPRJMOD} variable for portability. ```bash easyeda2kicad --full --lcsc_id=C2040 --output ~/myproject/libs/my_lib --project-relative ``` -------------------------------- ### SOLIDREGION Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_FOOTPRINT.md Defines the structure for filled polygon regions in EasyEDA files. ```text SOLIDREGION~layer_id~net~path~region_type~id~~[is_locked] ``` ```text SOLIDREGION~99~~M 3976.4252 3009.7242 L 3979.5748 3009.7242 L 3979.5748 3012.8738 L 3976.4252 3012.8738 Z~solid~gge344~~0 ``` -------------------------------- ### Limitations and Debugging Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Outlines the limitations of the EasyEDA to KiCad 3D model workflow and provides instructions for enabling local caching for debugging. ```APIDOC ## Limitations | Issue | Description || |------------------------|---------------------------------------------|| | Network Required | 3D models cannot be obtained offline || | Material Approximation | VRML may not perfectly match OBJ appearance || | Server Dependency | Requires EasyEDA servers to be available || ## Debug Caching Enable local caching for faster re-conversion and debugging purposes. ### Enable Debug Logging ```python import logging logging.basicConfig(level=logging.DEBUG) ``` ### Cache Location - **Directory:** `.easyeda_cache/` - **Files:** `{uuid}.obj`, `{uuid}.step` ``` -------------------------------- ### Extract EasyEDA Symbol Data Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Demonstrates how to import symbol data and access its metadata, geometry, and pin details. ```python # Import symbol data importer = EasyedaSymbolImporter(easyeda_cp_cad_data=cad_data) ee_symbol = importer.get_symbol() # Access symbol information print(f"Name: {ee_symbol.info.name}") # e.g., "NE555DR" print(f"Prefix: {ee_symbol.info.prefix}") # e.g., "U" print(f"Package: {ee_symbol.info.package}") # e.g., "SOIC-8_L5.0-W4.0-P1.27" print(f"Manufacturer: {ee_symbol.info.manufacturer}") print(f"MPN: {ee_symbol.info.mpn}") print(f"Datasheet: {ee_symbol.info.datasheet}") print(f"LCSC ID: {ee_symbol.info.lcsc_id}") print(f"Keywords: {ee_symbol.info.keywords}") print(f"Description: {ee_symbol.info.description}") # Access symbol geometry print(f"Pins: {len(ee_symbol.pins)}") print(f"Rectangles: {len(ee_symbol.rectangles)}") print(f"Circles: {len(ee_symbol.circles)}") print(f"Ellipses: {len(ee_symbol.ellipses)}") print(f"Arcs: {len(ee_symbol.arcs)}") print(f"Polylines: {len(ee_symbol.polylines)}") print(f"Polygons: {len(ee_symbol.polygons)}") print(f"Paths: {len(ee_symbol.paths)}") print(f"Texts: {len(ee_symbol.texts)}") print(f"Sub-symbols (multi-unit): {len(ee_symbol.sub_symbols)}") # Access pin details for pin in ee_symbol.pins: print(f"Pin {pin.settings.spice_pin_number}: {pin.name.text}") print(f" Position: ({pin.settings.pos_x}, {pin.settings.pos_y})") print(f" Rotation: {pin.settings.rotation}") print(f" Type: {pin.settings.type}") print(f" Inverted: {pin.dot.is_displayed}") print(f" Clock: {pin.clock.is_displayed}") # Bounding box for coordinate transformation print(f"Bbox origin: ({ee_symbol.bbox.x}, {ee_symbol.bbox.y})") print(f"Bbox size: {ee_symbol.bbox.width} x {ee_symbol.bbox.height}") ``` -------------------------------- ### Pin Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md The raw string format for defining a pin in EasyEDA symbols, using tildes and double carets as delimiters. ```text P~visibility~type~spice_pin_number~x~y~rotation~id~is_locked^^dot_x~dot_y^^path~color^^name_data^^number_data^^dot_data^^clock_data ``` -------------------------------- ### PAD - Footprint Pad Command Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_FOOTPRINT.md Defines a footprint pad, supporting both SMD and through-hole types. It includes shape, position, dimensions, layer, net, number, hole details, rotation, and plating information. ```APIDOC ## PAD - Footprint Pad ### Description Defines a footprint pad, supporting both SMD and through-hole types. It includes shape, position, dimensions, layer, net, number, hole details, rotation, and plating information. ### Format ``` PAD~shape~center_x~center_y~width~height~layer_id~net~number~hole_radius~points~rotation~id~hole_length~slot_outline~is_plated~is_locked~clearance1~clearance2~hole_point ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` PAD~RECT~3994.299~2995~9.0551~9.0551~11~~1~2.7559~3989.7715 2990.4725 3998.8266 2990.4725 3998.8266 2999.5276 3989.7715 2999.5276~0~gge118~0~~Y~0~0~0.19685~3994.299,2995 ``` ### Response #### Success Response (200) This command does not have a direct API response in this context; it's a data definition format. #### Response Example None ``` -------------------------------- ### Export 3D Model to KiCad Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Converts EasyEDA 3D models to VRML and STEP formats compatible with KiCad. ```python from easyeda2kicad import ( EasyedaApi, Easyeda3dModelImporter, Exporter3dModelKicad ) # Fetch and import 3D model api = EasyedaApi(use_cache=True) cad_data = api.get_cad_data_of_component(lcsc_id="C2040") model_importer = Easyeda3dModelImporter( easyeda_cp_cad_data=cad_data, download_raw_3d_model=True, api=api ) # Create exporter exporter = Exporter3dModelKicad(model_3d=model_importer.output) if exporter.output: # Export WRL and STEP files success = exporter.export( output_dir="/path/to/library.3dshapes", overwrite=True ) if success: print(f"Exported: {exporter.output.name}.wrl") print(f"Exported: {exporter.output.name}.step") # Access raw WRL content if exporter.output.raw_wrl: print(f"WRL content: {len(exporter.output.raw_wrl)} bytes") else: print("No 3D model to export") ``` -------------------------------- ### EasyEDA OBJ Download Endpoint Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Use this endpoint to download 3D models in OBJ format. The response is a text file containing vertices and materials. Units are in millimeters. ```http https://modules.easyeda.com/3dmodel/{uuid} ``` -------------------------------- ### Export Footprint to KiCad Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Converts EasyEDA footprint data to .kicad_mod format, including 3D model references and detailed pad information. ```python from easyeda2kicad import ( EasyedaApi, EasyedaFootprintImporter, ExporterFootprintKicad ) # Fetch and import footprint api = EasyedaApi() cad_data = api.get_cad_data_of_component(lcsc_id="C2040") ee_footprint = EasyedaFootprintImporter(easyeda_cp_cad_data=cad_data).get_footprint() # Create exporter exporter = ExporterFootprintKicad(footprint=ee_footprint) # Export to file exporter.export( footprint_full_path="/path/to/library.pretty/SOIC-8.kicad_mod", model_3d_path="${EASYEDA2KICAD}/easyeda2kicad.3dshapes", model_3d_extension="wrl" # or "step" ) # Access converted KiCad footprint data ki_footprint = exporter.get_ki_footprint() print(f"KiCad footprint name: {ki_footprint.info.name}") print(f"KiCad footprint type: {ki_footprint.info.fp_type}") print(f"Pads: {len(ki_footprint.pads)}") print(f"Tracks: {len(ki_footprint.tracks)}") print(f"Holes: {len(ki_footprint.holes)}") print(f"Circles: {len(ki_footprint.circles)}") print(f"Arcs: {len(ki_footprint.arcs)}") # Access pad details for pad in ki_footprint.pads: print(f"Pad {pad.number}: type={pad.type}, shape={pad.shape}") print(f" Position: ({pad.pos_x}, {pad.pos_y}) mm") print(f" Size: {pad.width} x {pad.height} mm") print(f" Layers: {pad.layers}") print(f" Drill: {pad.drill}") ``` -------------------------------- ### SVGNODE Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_FOOTPRINT.md Defines the structure for 3D model metadata stored as JSON. ```text SVGNODE~{JSON}~... ``` ```text SVGNODE~{"gId":"g1_outline","attrs":{"uuid":"ed3be94b43cd45f99a7c943270463433","title":"CONN-TH_TE_1-770174-0","c_origin":"3986.1495,3002.1653","z":"-16.5354","c_rotation":"0,0,0"}}~... ``` -------------------------------- ### EasyEDA Polyline Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md Use the 'PL' command to define a polyline. Specify points, stroke color, width, style, fill color, ID, and lock status. Points are space-separated coordinates. ```text PL~points~stroke_color~stroke_width~stroke_style~fill_color~id~locked ``` ```text PL~380 290 390 290 390 310 380 310~#880000~1~0~none~gge8~0 ``` -------------------------------- ### Overwrite existing library components Source: https://github.com/upesy/easyeda2kicad.py/blob/master/README.md Forces the tool to replace existing files in the specified library path. ```bash easyeda2kicad --full --lcsc_id=C2040 --output ~/libs/my_lib --overwrite ``` -------------------------------- ### Define Path Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md The PT command defines SVG path data for symbol outlines. ```text PT~path~stroke_color~stroke_width~stroke_style~fill_color~id~locked ``` ```text PT~M 380 300 L 390 300 L 390 310~#880000~1~0~none~gge11~0 ``` -------------------------------- ### Convert Coordinates to KiCad Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md Coordinate transformation logic for mapping EasyEDA canvas units to KiCad formats. ```python # Symbol units to KiCad v6+ (mm) ki_x_mm = (ee_x - bbox_x) * 10 * 0.0254 ki_y_mm = -(ee_y - bbox_y) * 10 * 0.0254 # Note: Y inverted ``` ```python # Symbol units to KiCad v5 (mils) ki_x_mils = (ee_x - bbox_x) * 10 ki_y_mils = -(ee_y - bbox_y) * 10 # Note: Y inverted ``` -------------------------------- ### KiCad Footprint Model Reference Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md References WRL (VRML) and STEP 3D models within a KiCad footprint file (.kicad_mod). Specifies the model path, position, scale, and rotation. ```kicad_mod (model "${EASYEDA2KICAD}/IND-SMD_L7.0-W6.6-H3.0.wrl" (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) ) (model "${EASYEDA2KICAD}/IND-SMD_L7.0-W6.6-H3.0.step" (at (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0)) ) ``` -------------------------------- ### OBJ to VRML Conversion Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Details the process of converting OBJ 3D models to VRML format for KiCad, including coordinate scaling and VRML structure. ```APIDOC ## OBJ → WRL Conversion ### Coordinate Conversion Converts OBJ model units from millimeters to inches for VRML compatibility. **Formula:** ```python inch = mm / 25.4 ``` **Example:** - OBJ: `v 25.4 50.8 76.2` (mm) - WRL: `1.0 2.0 3.0` (inches) ### VRML Output Format Defines the structure of the VRML file, including appearance, material properties, and indexed face set geometry. ```vrml #VRML V2.0 utf8 Shape { appearance Appearance { material Material { diffuseColor 0.8 0.8 0.8 specularColor 0.5 0.5 0.5 ambientIntensity 0.2 transparency 0 shininess 0.5 } } geometry IndexedFaceSet { ccw TRUE solid FALSE coord Coordinate { point [ 1.0 2.0 3.0, 2.0 3.0 4.0, ... ] } coordIndex [ 0, 1, 2, -1, 1, 2, 3, -1, ... ] } } ``` **Notes:** - Each OBJ material corresponds to a separate VRML `Shape` node. - OBJ vertex indices are 1-based, while VRML `coordIndex` is 0-based. - The face delimiter in `coordIndex` is `-1`. ``` -------------------------------- ### Search JLCPCB Parts Library Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Search the JLCPCB component library using keywords, pagination, and part type filters. Returns a dictionary with total results and a list of matching components. ```python # Search JLCPCB parts library results = api.search_jlcpcb_components( keyword="STM32F103", page=1, page_size=10, part_type="base" # "base" = Basic parts, "expand" = Extended parts ) # Returns: { # 'total': 42, # 'results': [ # { # 'lcsc': 'C8734', # 'name': 'STM32F103C8T6', # 'model': 'STM32F103C8T6', # 'brand': 'STMicroelectronics', # 'package': 'LQFP-48', # 'category': 'Microcontrollers (MCU/MPU/SOC)', # 'stock': 125000, # 'type': 'Basic', # or 'Extended' # 'price': 2.5, # 'price_breaks': [{'qty': 1, 'price': 2.5}, {'qty': 10, 'price': 2.3}], # 'min_qty': 1, # 'description': 'ARM Cortex-M3 72MHz...', # 'url': 'https://lcsc.com/product-detail/...', # 'datasheet': 'https://...', # 'attributes': [{'name': 'Core', 'value': 'ARM Cortex-M3'}] # } # ] # } ``` -------------------------------- ### Export Symbol to KiCad Library Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Converts EasyEDA symbol data into a KiCad symbol library file, supporting custom fields and library path management. ```python from easyeda2kicad import ( EasyedaApi, EasyedaSymbolImporter, ExporterSymbolKicad ) # Fetch and import symbol api = EasyedaApi() cad_data = api.get_cad_data_of_component(lcsc_id="C2040") ee_symbol = EasyedaSymbolImporter(easyeda_cp_cad_data=cad_data).get_symbol() # Create exporter with optional custom fields exporter = ExporterSymbolKicad( symbol=ee_symbol, lib_path="/path/to/library.kicad_sym", # Optional: for version detection custom_fields={"Supplier": "LCSC", "Cost": "0.50"} ) # Export to string (for inspection) kicad_content = exporter.export(footprint_lib_name="my_footprints") print(kicad_content) # Save to library file (creates file if needed, replaces if exists) success = exporter.save_to_lib( lib_path="/path/to/library.kicad_sym", footprint_lib_name="my_footprints", overwrite=True # Replace existing symbol with same name ) if success: print("Symbol saved successfully") else: print("Symbol already exists, use overwrite=True to replace") # Access converted KiCad symbol data ki_symbol = exporter.output print(f"KiCad symbol name: {ki_symbol.info.name}") print(f"KiCad pins: {len(ki_symbol.pins)}") print(f"KiCad rectangles: {len(ki_symbol.rectangles)}") print(f"KiCad circles: {len(ki_symbol.circles)}") print(f"KiCad arcs: {len(ki_symbol.arcs)}") print(f"KiCad polygons: {len(ki_symbol.polygons)}") print(f"KiCad beziers: {len(ki_symbol.beziers)}") ``` -------------------------------- ### OBJ Faces Definition Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Defines the faces of the 3D model using vertex indices. 'usemtl' specifies the material for subsequent faces. Faces are defined by listing the vertex indices that form them. ```obj usemtl material_name f 1 2 3 # Triangle using vertices 1,2,3 f 2 3 4 ``` -------------------------------- ### Convert Individual Component Parts Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Convert only the symbol, footprint, or 3D model of a component using its LCSC ID. Each part can be converted independently. ```bash easyeda2kicad --symbol --lcsc_id=C2040 ``` ```bash easyeda2kicad --footprint --lcsc_id=C2040 ``` ```bash easyeda2kicad --3d --lcsc_id=C2040 ``` -------------------------------- ### Coordinate Transformation for KiCad Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Explains how translation and rotation are applied to 3D models when integrating them into KiCad footprints. ```APIDOC ## Coordinate Transformation ### Translation Translation offsets are embedded within the WRL vertex coordinates during the OBJ to WRL conversion. The center of the OBJ bounding box is subtracted from all vertices, effectively centering the model at (0,0,0). This ensures that the KiCad footprint receives the model with an offset of (0, 0, 0). ```python # All footprint types — offset fully encoded in WRL vertices translation = Ki3dModelBase(x=0.0, y=0.0, z=0.0) ``` ### Rotation Applies rotation transformations from EasyEDA to KiCad, converting degrees. ```python # EasyEDA → KiCad (degrees) rx = 360 - model_3d.rotation.x ry = 360 - model_3d.rotation.y rz = 360 - model_3d.rotation.z ``` ``` -------------------------------- ### EasyEDA Arc Command Format Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_SYMBOL.md Use the 'A' command to define an arc. Specify path, stroke color, width, style, fill color, ID, and lock status. The SVG arc path format includes move-to and arc-to commands with radii and flags. ```text A~path~helper_dots~stroke_color~stroke_width~stroke_style~fill_color~id~locked ``` ```text A~M 383.117 299.932 A 4 3.9 0 1 1 391.082 299.936~~#880000~1~0~none~gge17~0 ``` -------------------------------- ### EasyedaApi Component Data Fetching Source: https://context7.com/upesy/easyeda2kicad.py/llms.txt Methods for retrieving detailed CAD data, raw API responses, and 3D model files for specific components using their LCSC ID or UUID. ```APIDOC ## GET /get_cad_data_of_component ### Description Fetches complete CAD data for a component by its LCSC ID. ### Parameters #### Query Parameters - **lcsc_id** (string) - Required - The LCSC part number (e.g., C2040). ### Response #### Success Response (200) - **data** (dict) - Returns a dictionary containing 'dataStr', 'packageDetail', 'lcsc', 'tags', and 'description'. ## GET /get_info_from_easyeda_api ### Description Retrieves the raw API response from the EasyEDA service. ### Parameters #### Query Parameters - **lcsc_id** (string) - Required - The LCSC part number. ### Response #### Success Response (200) - **response** (dict) - Returns a dictionary with 'success' status and 'result' containing component data. ## GET /get_raw_3d_model_obj ### Description Downloads the raw 3D model in OBJ format. ### Parameters #### Query Parameters - **uuid** (string) - Required - The component UUID. ### Response #### Success Response (200) - **obj_data** (string) - Returns OBJ text or null if not found. ## GET /get_step_3d_model ### Description Downloads the 3D model in STEP format. ### Parameters #### Query Parameters - **uuid** (string) - Required - The component UUID. ### Response #### Success Response (200) - **step_data** (bytes) - Returns STEP file bytes or null if not found. ``` -------------------------------- ### EasyEDA 3D Model Download Endpoints Source: https://github.com/upesy/easyeda2kicad.py/blob/master/docs/CMD_3D_MODEL.md Provides the API endpoints for downloading 3D models in OBJ and STEP formats from EasyEDA servers using a unique UUID. ```APIDOC ## Download Endpoints ### OBJ Format (Text-based) #### Endpoint ``` https://modules.easyeda.com/3dmodel/{uuid} ``` #### Response Text file containing vertices and material definitions. #### Units Millimeters ### STEP Format (Binary CAD) #### Endpoint ``` https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y/{uuid} ``` #### Response Binary STEP file (ISO 10303-21). #### Notes - `qAxj6KHrDKw4blvCG8QJPs7Y` is EasyEDA's storage bucket ID. - STEP files are passed through without modification. ```