iCraft Editor and Player

repository·main·Indexed 23 days ago

https://github.com/gantfdt/icraft

A 3D architectural design tool for creating immersive diagrams of complex software and physical systems. iCraft Editor features 2D-to-3D transformation, nestable sub-scenes, and precision tools for designing system architectures. iCraft Player allows for the integration of these 3D scenes into applications with API-driven state control, real-time data synchronization for digital twins, and support for GLB/GLTF model imports.

Tokens
35K
Snippets
76
Records
154
Agent score
76%

What's inside iCraft

  1. Overview of iCraft Editor

    main
    iCraft Editor is a tool designed for creating 3D architecture diagrams. It moves beyond traditional 2D flat planes to provide three-dimensional visual effects, helping users capture attention and improve communication efficiency when designing complex systems. It is suitable for software architecture design, system deployment visualization, training, and expressing structural relationships (like BOM structures).
  2. Features of @icraft/player-react

    main

    The @icraft/player-react library provides several capabilities for building digital twin applications:

    • Out-of-the-box integration: Zero-configuration setup for quick access.
    • Customizable plugin sets: Support for integrating optional features via a flexible plugin mechanism.
    • Events and Methods: A rich set of APIs to facilitate integration with your existing project logic.
    • Animation Control: Support for playback controls such as auto-play and looping.
    • Real-time Data Integration: Capability to connect real-time data streams to 3D scenes for digital twin visualization.
  3. Key features of @icraft/player-react

    main

    The @icraft/player-react library provides several capabilities for building 3D digital twin applications:

    • Zero configuration integration: Quick setup with minimal code.
    • Custom Plugin Sets: Extend functionality through a flexible plugin mechanism.
    • Events and Methods: Rich API for interacting with the 3D scene from your React code.
    • Animation Control: Support for autoplay, loop playback, and other controls.
    • Real-time Data Integration: Capability to map real-time data (e.g., server metrics, e-commerce transactions, or industrial production data) into the 3D environment.
  4. Customize and control floating tips (悬浮提示)

    main

    You can control the content, visibility, and appearance of floating tips by accessing the tip property on an element instance. This allows you to replace default tooltips with custom HTML elements, such as user profile cards or complex UI components.

    To use a custom tip, you typically:

    1. Locate the target element using getElementsByName or similar methods.
    2. Create a new DOM element containing your custom content and styles.
    3. Use the tip instance methods to inject the element and make it visible.
  5. Advantages of using Nested Subscenes in iCraft Editor

    main

    Nested subscenes provide several architectural visualization benefits:

    • Layered Display: Enables a "drill-down" approach, moving from high-level overviews to granular component details (e.g., Cloud $\rightarrow$ VM $\rightarrow$ Service).
    • Modular Clarity: Represents modular designs intuitively by showing the internal composition and dependencies of specific modules.
    • Information Hiding: Reduces visual clutter by hiding complex internal details behind top-level structures, showing them only on demand.
    • Scalability: Makes large-scale system visualization feasible by managing different modules in separate subscenes.
    • Interactive Exploration: Supports dynamic navigation through different levels of the architecture via clicks and zooming.
  6. What are Addons in iCraft Player?

    main
    Addons are extension components for the iCraft Player that provide additional functionality. They allow you to add features like camera controls, zoom controls, sub-scene navigation, and player controls to your player instance. Users can enable them using predefined keys for quick setup or manually import and style them for custom layouts.
  7. Customize hover tips (悬浮提示)

    main

    You can customize the content, style, and visibility of hover tips by accessing the tip property on an element instance. There are two primary ways to implement custom tips:

    1. Native Elements: Create standard DOM elements (e.g., using document.createElement) and pass them to the tip instance.
    2. React Elements: Use react-dom's createPortal to render React components into a DOM node managed by the tip instance. This is the recommended approach for complex UI components.

    To access the tip instance, first find the target element using player.getElementsByName(name) and then access its .tip property.

  8. Key Features of iCraft Editor

    main

    iCraft Editor provides several core capabilities for 3D architectural design:

    Design Capabilities

    • 3D Model Elements: Access to a rich library of exquisite 3D models and geometric shapes.
    • Templates: Example templates to accelerate the design process.
    • View Switching: One-click toggle between 2D and 3D views.
    • Precision Tools: Automatic grid snapping for connections, and automatic stacking/magnetic attraction for drawing elements.
    • Nestable Sub-scenes: Modular management of complex designs by nesting multiple sub-scenes within a main scene. Each sub-scene can be edited and adjusted independently.

    Presentation Capabilities

    • Immersive Views: 3D panoramic presentation with freely transformable multi-angle views (rotate, zoom, examine).
    • Animation: Supports animation playback to convey design concepts.
    • Layered Concepts: Seamless switching between sub-scene states to express complex designs in layers.

    Digital Twin & Integration

    • Web Rendering: Embeddable Web rendering components.
    • API Control: Control 3D element states through APIs.
    • Real-time Synchronization: Visualizes synchronization between Web system information and 3D architecture diagrams (e.g., displaying server or network device status).
    • External Model Integration: Supports importing common 3D file formats such as GLB and GLTF.
  9. Advantages of using 3D system architecture diagrams

    main

    3D architecture diagrams provide several benefits over traditional 2D diagrams for complex systems like microservices or distributed cloud infrastructure:

    • Clearer Hierarchical Relationships: Uses 3D space to show nesting and dependencies (e.g., layers or modules) without the visual clutter of 2D layouts.
    • Intuitive Interaction: Supports rotation, scaling, and dragging, allowing users to focus on specific parts of the system from multiple angles.
    • Rich Information Visualization: Uses color, size, shape, and transparency to represent system states, performance, or load.
    • Complexity Management: Effectively handles large-scale distributed systems and multi-layer network architectures that are difficult to represent in 2D.
    • Improved Team Collaboration: Provides a common visual language for developers, architects, and product managers.
    • Dynamic Simulation: Can be combined with dynamic simulations to demonstrate workflows, request flows, or real-time performance data.
  10. How tooltips (Tips) work in iCraft Player

    main

    A Tip is a tooltip associated with an element instance in the iCraft Player. You can access the tooltip instance via the .tip property on an element instance. By calling methods on this instance, you can dynamically update the tooltip's content, visibility, height, and style. There are two primary patterns for using tooltips: using native DOM elements or using React elements via Portals.

    const user = player?.getElementsByName("User")?.[0];
    user?.tip?.updateInnerHTML(someElement);
    user?.tip?.updateVisible(true);
  11. How font resources work in iCraft Editor

    main

    Because iCraft Editor's drawing engine is based on WebGL, font resources are not handled by the browser's standard CSS engine in the same way and must be loaded explicitly.

    If you do not actively set font resources using defineConfig, the editor will attempt to use default fonts from the iCraft Editor server and Google. For intranet or offline environments, you should download the required .ttf files and host them locally within your project, then point to them using fontUrl or fonts.