Geometry Sketcher

edited September 2021 in General
This discussion was created from comments split from: CAD Add-on in Blender (and other useful Add-ons).

Constraint-based sketcher addon for Blender that allows to create precise 2d shapes by defining a set of geometric constraints like tangent, distance, angle, equal and more. Sketches stay editable and support a fully non-destructive workflow.

code: https://github.com/hlorus/geometry_sketcher
«13

Comments

  • I feel like if we could improve geometry sketcher than it will be apretty good solution. Maybe a small brainstorming about whats missing/potential features?

    Bedson
  • Hey there,
    I'm the developer of BGS. Thanks a lot for sharing, it's great to see people being exited about this!
    The addon is based on Solvespace which is a standalone, simplistic CAD program, maybe that's also something to consider using directly.
    Unfortunately i'm not too familiar with the architecture use-case but i'm definitely interested to hear more about it and to explore possible improvements and integrations with existing software/workflows. However it should be noted that a CAD software includes a lot more than just a dynamic sketcher. BGS will not change the fact that blender is mesh based which can be a limiting factor for mechanical applications. I also don't think it's planned for blender to make huge steps into that direction. So i wouldn't really see it as a replacement for a CAD software.

    brunopostle
  • Great to have you hear.
    I hope you are fine with me posting your addon without having asked you before.
    You did a really great job! Thank you.
    Would you mind sharing some backrgound information about the purpose of your addon and the roadmap?
    Which features do you plan to implement?

  • @Moult I suppose it shouldn't be too hard to support this as a base for blenderbims wall generating script?

  • Sure thing, i come from a technical background as well and used blender mostly for product visualization. This usually includes exporting nurbs data to some kind of mesh format which makes working with that data painful. When i started with BGS i didn't really plan ahead, the goal is simply to improve blender for technical use-cases which in the long term will hopefully lead to a bigger community and more interested developers in that area.

    There's no roadmap yet also the purpose and scope isn't set in stone. I'd like to get involvement from the community as soon as possible and gather possible use-cases and workflows.

    Some features i might work on (contributors are obviously welcome):

    • Solver failure: Add warning and description and maybe helper tools when solver fails / display failed constraints / communicate degrees of freedom
    • Stability: Bug fixing / Improve error handling, logging, core integration architecture / add python tests
    • Referencing: Allow to reference blender or other BGS geometry in a sketch, geometry would get projected onto sketch / place sketches onto existing geometry
    • UI/UX Improvements: auto-constrain while drawing / draw constraint icons and values in viewport / add primitive tools e.g. rectangle / add missing icons / add continuous drawing or multi-draw tool
    • Improve converter: respect loose connections (e.g. segments connected by coincident constraints) / ensure drawn profile is unambiguous (maybe communicate to the user or pre-process ambiguous shapes) / add other types of integration, maybe exposing a node to integrate into geometry nodes is possible
    • Add missing constraint types that are supported by solvespace
    • Write documentation

    greetings hlorus

    stephen_lSinastatheoryshawbrunopostle
  • Might be a huge helper for missing archipack's basic logick bricks like constraint driven design.

  • @hlorus said:
    Sure thing, i come from a technical background as well and used blender mostly for product visualization. This usually includes exporting nurbs data to some kind of mesh format which makes working with that data painful. When i started with BGS i didn't really plan ahead, the goal is simply to improve blender for technical use-cases which in the long term will hopefully lead to a bigger community and more interested developers in that area.

    There's no roadmap yet also the purpose and scope isn't set in stone. I'd like to get involvement from the community as soon as possible and gather possible use-cases and workflows.

    Some features i might work on (contributors are obviously welcome):

    • Solver failure: Add warning and description and maybe helper tools when solver fails / display failed constraints / communicate degrees of freedom
    • Stability: Bug fixing / Improve error handling, logging, core integration architecture / add python tests
    • Referencing: Allow to reference blender or other BGS geometry in a sketch, geometry would get projected onto sketch / place sketches onto existing geometry
    • UI/UX Improvements: auto-constrain while drawing / draw constraint icons and values in viewport / add primitive tools e.g. rectangle / add missing icons / add continuous drawing or multi-draw tool
    • Improve converter: respect loose connections (e.g. segments connected by coincident constraints) / ensure drawn profile is unambiguous (maybe communicate to the user or pre-process ambiguous shapes) / add other types of integration, maybe exposing a node to integrate into geometry nodes is possible
    • Add missing constraint types that are supported by solvespace
    • Write documentation

    greetings hlorus

    Can it please, please be made to work with Grease Pencil as an option?

  • @DADA_universe said:
    Can it please, please be made to work with Grease Pencil as an option?

    I never thought about that, how do you imaging this to work? Should it be possible to generate BGS geometry from Grease Pencil or the other way around? In what scenarios do you think this would be helpful?

  • See this discussion:
    https://community.osarch.org/discussion/comment/2816/#Comment_2816
    We are trying to develop a workflow where you sketch a design and it gets translated into a parametric bim model. I made a demo, where you can use blenders greasepencil to sketch and sverchok (graphical scripting addon) to generate the model. The biggest part missing was the geometry solver, to be able to constrain the design.
    So the question now is, can we use greasepencil strokes as a dynamic input for your sketches?

  • BlenderBIm has also implemented using the annotation tool to draw walls and it honestly works really well:

  • @hlorus yes what JanF said. I would think Grease Pencil to BGS geometry would be the way to go, but it would be fantastic to be able to do that in a non destructive way so you can still take the line drawings from your sketches and add annotation to them in Grease Pencil, taking advantage of Grease Pencil's layers, brushes, onion skinning, etc.
    Awesome to see what you've got going thus far.

  • I didn't look into Grease Pencil yet but i think it should be generally possible to convert it to BGS geometry. BGS could support an import option, something like "Geometry from GP Layer" as a one time operation. However i think there would come bigger problems with following features:

    • Auto constraints
      GP doesn't have any constraints, guessing constraints that make sense and not overconstraining the sketch might not be trivial

    • Dynamic reference
      This is still an open topic, being able to reference a mesh vertex, GP stroke etc. in a sketch would definitely be a powerful feature. However i wouldn't really advise it for such a workflow, better just converting strokes and deleting them thereafter and allowing to add additional strokes to the same sketch.

    • Approaching geometry
      When having this as a generic import method it wouldn't be enough to generate lines. Freeform geometry would have to be approached somewhat accurately which should also work with curves. Also trimming of standing out geometry might not be what's expected from such a importer.

    To discuss some alternatives:
    Why not improve BGS tools to be faster and more fluent to use? Also maybe a generic BGS "free draw tool" could be considered. Where strokes would directly be converted after drawing.

    Anyway i think it should be possible to integrate BGS into specific use-cases and tools but i would suggest to keep itself as generic as possible and focus on better integration into native blender and various aspects of it, like GP.

    More specific tools and workflows however should be covered by other addons. So an important question is probably: How can other addons and BGS integrate/communicate? I assume either one of the following could be a solution:

    • BGS exposing an API which other addons can use as long as BGS is installed and enabled
    • Extract a BGS-Core from the current addon which could be forked into other projects.

    Greetings hlorus

    DADA_universeJanFtheoryshaw
  • Oh wow BGS looks awesome! Would love to integrate it a bit further, but I need to build a bit more of the parametric engine system in the BlenderBIM Add-on first to allow arbitrary systems to generate IFC geometry. Would love to organise a meetup to discuss the details!

    DADA_universehlorustheoryshaw
  • I've made a "quick" demo script to show how external addons could use the functionality of BGS. Note that for this specific demo to work the python module "scipy" has to be installed in blenders python. If you don't know how to install it, it should work by pasting following lines into the console inside blender:
    from geometry_sketcher.functions import install_package
    install_package("scipy")

    JanFbruno_perdigaoMeetlattheoryshawbitacovirDADA_universeGorgiousJQL
  • @Moult said:
    Oh wow BGS looks awesome! Would love to integrate it a bit further, but I need to build a bit more of the parametric engine system in the BlenderBIM Add-on first to allow arbitrary systems to generate IFC geometry. Would love to organise a meetup to discuss the details!

    Yeah sure, let me know when you have time for a meeting!

    theoryshaw
  • Are generated entiy edges or curves based ?
    Any way to register "callbacks" from outside world ? like "on_create / on_update / on_delete" ?
    As far as i can tell addon interactions does not need your own addon to be enabled, we are able to import parts from other addons even when disabled.
    The blender's dependancy addons structure depends on setup time .. so it is not predictable and disable / enable will change order. But direct import allow to bypass this limitation - assuming the root folder of your addon will not change over time.

  • @stephen_l said:
    Are generated entiy edges or curves based ?

    Not sure if i understand the question correctly, BGS entities are not based on any native blender geometry, they're stored with PropertyGroups and drawn with a draw handler. Those PropertyGroups hold the neccesary data which might also be a pointer to another entity. A curve, as an example, simply holds pointer indices to center, start and endpoint. Only when drawing or exporting the geometry it will be converted to a set of vertices.

    Any way to register "callbacks" from outside world ? like "on_create / on_update / on_delete" ?

    Currently no but this might be a good target to allow for better integration.

    As far as i can tell addon interactions does not need your own addon to be enabled, we are able to import parts from other addons even when disabled.
    The blender's dependancy addons structure depends on setup time .. so it is not predictable and disable / enable will change order. But direct import allow to bypass this limitation - assuming the root folder of your addon will not change over time.

    I'm not quite sure how you imagine this to work, i'm aware that it's possible to import modules from other scripts however i don't see how this would work with classes that get registerd inside blender (e.g. Operators, Properties, Panels) as they might already be registered.

  • My strategy with blenderbim is to import at runtime, so whatever the setup order, install status it does work.

  • @JanF said:
    Geometry sketcher is awesome!

    i too, am excited about this functionality!

  • Adding @JanF's comment below, that I accidently split off into an isolated forum thread.

    @JanF said:
    Geometry sketcher is awesome!

  • @JanF In the example above, how did you not create a 'face' on the mesh?
    As you can see below, mine has a 'face'.

  • @hlorus said:

    This is cool, got great prospects! Covers the first half of my ruminations to do with sketching design with GP already. Connecting this to Archipack (and hence BlenderBIM) for fleshing out in 3D and all the other BIM goodies, takes that further for the BIM workflow. The last mile would be the holy grail of 2d documentation as always, and my haunch is that GP combined with MeasureItArch can be Jerry-Rigged to work like Layout in Sketchup and Layout in Form Z, either by reading from the Property Sets on the fly or generating 2d representations in GP, of Archipack elements as they are being created, or both, to which dimensions and annotations can be added. GP already exports cleanly to SVG so there's a clear path for the final output.

    Bedson
  • @theoryshaw said:
    @JanF In the example above, how did you not create a 'face' on the mesh?
    As you can see below, mine has a 'face'.

    I added a planar decimate modifier to get rid of the triangles and then screw+ solidify to make the wall.

    theoryshaw
  • @DADA_universe definiely a true dream for archipack, parametric contraints are badly missing feature, will definitely take a close look at ways to integrate.
    By the way, at this time, archipack's walls curve input does support grease pencil strokes.

  • @stephen_l said:
    By the way, at this time, archipack's walls curve input does support grease pencil strokes.

    Great to know! I'll be trying that out for the next project I'm about to start working on.

  • I'm embarrassed to admit it, after all the great feedback above, I cannot get Geometry Sketcher to work, or I don't understand how it works? I cannot find a Youtube video or any other beginner guide or Idiot's guide :) Any help will be appreciated

  • @Nigel said:
    I'm embarrassed to admit it, after all the great feedback above, I cannot get Geometry Sketcher to work, or I don't understand how it works? I cannot find a Youtube video or any other beginner guide or Idiot's guide :) Any help will be appreciated

    Does this help?

    Nigeltlang
  • Thanks @JanF! I smoothed out the face, is there a modifier to remove the face?

  • edited September 2021

    What would be the purpose? The screw modifier removes the face and if you leave its screw parameter at zero, the mesh only has edges, but they get duplicated and are therefore not visible, so it's not very helpful I suppose.

    theoryshaw
  • edited September 2021

    Add a Weld modifier afterwards to merge duplicate vertices :

    You can also set the viewport and render steps to 1 to ease calculations.
    Note that you lose accurate vertex normals after using the Weld modifier.

    theoryshawJanF
Sign In or Register to comment.