Skip to content

Open Source CAD software with a Civil Engineering Focus.

License

Notifications You must be signed in to change notification settings

CarbonFlora/robusta

Repository files navigation

Robusta (CAD Plan Checker Utility)

Brief

Given station, bearing, line data information on plan, if a program can reconstruct the line work then it should be proof of constructability.

major problems

  1. Sometimes, entities will be stacked densely together and sometimes will nearly fully overlap each other. There needs to be a system in place to make this obvious. The software should detect this as an error that needs to be fixed before pushing to production. If selected and not an error, it should open a menu stating the REntity type and the first 3 tags.

Design Decisions

For CAD design, you can have entities follow a "lego" or "pin & string" framework.

  • lego framework:
  1. Entities own their end points. There is no parent/child relationship with the points defining the linework.
  • This is the simpler of the two methods to implement, but does not easily lend itself into great design due to the duplication.
  • pin & string:
  • Drafting using this method better follows the DRY method in programming.
  • It is easier to check for tolerances.
  • Each "line" is comprised of more entities. This is because you need entities for the line and endpoints. Workflow > mathmatically lay out points. All newly spawned points start as "floating" points as they are under no constraints. When a measure entity is assigned as the parent to the entity (dev: this could also be a component to the point entity. this decision will be based on flexibility.), this would convert the entity to "defined". Benchmarks and points and manually be set to "fixed" if it makes sense.

For Entity Editing, there is to methods of modification. The traditional method is through entity selection. After selecting the entity, you can drag, offset, etc.

  • This is the most intuitive to a beginner as it's expected selecting an entity means the intention to edit it. Mouse -> Mouse action.
  • Besides snapping, this is prone to mistakes as it requires precise mouse movement.

Entity Editing with custom GIT [bevy_git]:

  1. Creation: An entity is created.
  2. Modification: An entity has changed components.
  3. Deletion: An entity is despawned.

Major problems

  1. Currently, entities far from origin suffer from floating point error due to f32 type. It may be better to divide entity "islands" into chunks and save the translation from origin.
  2. Too many entities spawned raises the z-layer spawn height too high and entities can no longer be spawned. % These problems have been fixed. Entities are transformed instead of the camera. Orthographic Projection dictates a max of z=1000. Z-indexing increments in a smaller amount.

Ui Overhaul

  • The Ui will be a hybrid of Helix Editor and a standard gui-based editing surface. Experienced users will benefit from the mouse-less keybindings and beginners will benefit from the CADPanel.

Rewrite 2 Update

  • Take advantage of Bevy ECS change detection (https://docs.rs/bevy_ecs/latest/bevy_ecs/#change-detection).
  • Constraints: add coincident & extension constriant type.
  • Entity behavior click once: select the entity/place the point. bring up the constraints imposed on this entity. highlight the entity depending on if it's a fixed for floating entity. (entities that can have fixed and floating points use gradients.) click again on a definition point: If it's a fixed point, pick-up the point and move it to the mouse for dropping. If it's a float point, it bring up the constraints to be removed or converted to fixed point. Intersections: fixed-fixed > pick-up the point belonging to the line/arc selected. No constraints can be added. fixed-float > moving the fixed will also move the float, maintaining constraints. float-float > shouldn't be possible as it's underdefined. (untested)
  • Take into consideration the following:
    • Component Storage type
    • Component Bundles for organization
  • Phantom system is split into the pointer and the phantom entities. This is required for the function of multi-point definition entities.

Proposed Re-write 2

  • Term, dxf, core, bevy_egui are all fine. gui is the one that requires a re-write.
  • Use more of the ECS system by adding RobustaEntity into the entity itself via component. This way, Hashmap isn't required to correlate the two.
  • Take advantage of Bevy ECS change detection (https://docs.rs/bevy_ecs/latest/bevy_ecs/#change-detection).
  • Take into consideration the following:
    • Component Storage type
    • Component Bundles for organization
  • Break down systems into smaller chunks, then organize into plugins. Model after either bevy_egui or bevy_mod_picking.
    • This is to increase the modularity, and decrease the accumulation of code debt. This will also contribute to reducing update cycle bloat.
  • Since egui is immediate mode, the entire cadpanel will be re-drawn every frame.
  • Constraints: add coincident & extension constriant type.
  • Entity behavior click once: select the entity/place the point. bring up the constraints imposed on this entity. highlight the entity depending on if it's a fixed for floating entity. (entities that can have fixed and floating points use gradients.) click again on a definition point: If it's a fixed point, pick-up the point and move it to the mouse for dropping. If it's a float point, it bring up the constraints to be removed or converted to fixed point. Intersections: fixed-fixed > pick-up the point belonging to the line/arc selected. No constraints can be added. fixed-float > moving the fixed will also move the float, maintaining constraints. float-float > shouldn't be possible as it's underdefined. (untested)

Re-write 1

  • The primary window will host all the viewports and cameras.
  • The 2nd window will host the egui docking controlboard.

Todo!()

  • clone https://github.com/johanhelsing/bevy_pancam and change world_units_per_device_pixel so horizontal and vertical scrolling is the same. Can also fix some other Issues if it's easy.
  • add a 'fit to view' function
  • linear algebra library thru nalgebra, faer, or cgmath. nalgebra - general purpose faer - large matrix operation **cgmath - general purpose, easier to use angle trait. ** https://github.com/rustgd/cgmath what is swizzling lol --features mint for matrix interpo between libraries.
  • multiple viewports
  • impliment and undo and redo system. The easiest way is to save the global resource (uistate) into a buffer with ~20 or so layers.
  • instead of using bevy gizmos, upgrade to robusta entities when more control is required.

Brainstorming

  • Meta-entities Everything is made of simple points. Since everything is simple geometry, the functions will be limited. To increase capability, "lesser" geometry can be "tagged" with meta geometry like complexes (this is a meta-geometry comprised of a series of lines and arcs), alignments, maybe even lines and arcs. Meta-entities are divided into different types: lines & arcs - Inbetween points .. polylines, alignments -

  • Tags Playing on the idea if meta-entities, tags like polyline, alignments, line, arc are Use the Bevy ECS system alongside tags.

  • Alignments Technically this can be built with JUST lines or arcs, but for the sake of design it's complexes only.

  • Visualization Points that assume multiple tags are visualized with dynamic features like color phasing? Depending on the color scheme/config file, a point that is a parent to a line will phase blue.. Color phasing is dumb.

  • Constraint System This is important, but for another day.

  • Fence System In addition to the constraint system, have it so arcs and lines must be between two points. This is called the fence system as of now.


Bugs

  • On startup, using keys: [win + arrow keys] messes with the bevy focus system and app functionality is impacted. This is an upstream issue.
  • With [select nothing deselect all] on, clicking on the cadpanel deselects all even though the settings are changed.

QOL Features

  • Impliment a fuzzy-finder to the RTerm and its dictionary.
  • Icons to the constraints on the ribbon.
  • Similar to how helix/vim gives context clues on what mode you are in, give clues to what you are doing. Might be a good design philosophy where you are able to determine what is going on based on a screenshot alone.

Alignment of Text

Horizontal: Left, snap point is SW corner Center, snap point is S middle Right, snap point is SE corner Aligned, no movement, it's two points to define the text? basically, convert to "left" Middle, snap point is in the exact middle of horizontal and vertical Fit, same as aligned, but slightly different.

Vertical: Baseline, this takes into account the font passsing through the x-axis. It's most common. Bottom, Middle, Top,

Tag Behavior

Undefined behavior like an entity without any tags (including Default), should prevent the CAD from compiling. This is to prevent human errors from plaguing the design file.

A compiling design file must possess the following:

  1. No untagged entities.

Plugin Organization

Plugin Folder - This is the name of the plugin. mod.rs - This is where the bevy::app::Plugin implementation rests. Smaller functions can also be here. event.rs - This is where eventreaders, event structs, event enums rests. resource.rs - This is where memory allocations are rested. startup.rs - This is where startup functions rests. impl.rs - This is where the implementations sits.

About

Open Source CAD software with a Civil Engineering Focus.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages