[prj] Blender add-on to create technical drawing

2

Comments

  • The dxf export feature is a must-have for me, I've tested it on one of my projects, and although the processing time was very long and most of my input meshes were non manifold, the output result was very clean. I just wish the layers output would be more customizable. I like to have walls / windows / doors / etc on different layers.
    Currently I either use a setup with line art modifiers but the resulting geometry is not very clean, or a Geometry Nodes setup to actually cut the geometry but it's really hard to get occlusion right.

    So I'll be following along :)

    I've worked on a custom dxf exporter for Blender for a while now so don't hesitate if you want a helping hand on anything related to dxf in your addon. Cheers

  • Hi @Gorgious, thanks for your precious opinion.
    I wonder why processing time was very long: usually, even if there are a lot of entities in the scene, drawing time is not too long. Generally there are two reasons for long processing time:

    • some object in the scene is extremely complex (with a huge amount of vertices)
    • a large size of the camera along with a high scale value and/or a high level of detail (LOD) -> in this case you can probably change these values and reduce processing time without affecting the result

    Could you try to launch Blender by command line? This way you can analyze the log during the drawing: here you'll you find the timing for every operation and, at the end, a list reposrting drawing time for every object in the drawing.

    I just wish the layers output would be more customizable. I like to have walls / windows / doors / etc on different layers.

    Implementing customizable layers in the DXF drawing is absolutely doable although it's not so easy to find a good rule about it: as you know, in Blender objects can be assigned to multiple collections while in DXF every object can be associated to just one layer.

    I've worked on a custom dxf exporter for Blender for a while now so don't hesitate if you want a helping hand on anything related to dxf in your addon

    Thanks so much! I'll contact you if I need it

  • Actually the file crashes at the end so I don't get to see the output :) The dxf does export, but I think one of the last operations bugs out. It might be related to admin privileges since I'm writing the files to the desktop (Windows).

    I've got a bunch of printouts like Process GEO_N0_STR_Poutres.017 (instanced by None) during evaluation time but no timestamps.
    Here's the end of the stack trace

        pixels = flatten([list(range(px_from_x+(resolution[0]*y),
      File "C:\Users\\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\prj\utils.py", line 217, in flatten
        return [item for sublist in li for item in sublist]
      File "C:\Users\\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\prj\utils.py", line 217, in <listcomp>
        return [item for sublist in li for item in sublist]
    MemoryError
    Error   : EXCEPTION_ACCESS_VIOLATION
    Address : 0x00007FF66B6E3544
    Module  : blender.exe
    Thread  : 000085ec
    

    It seems it takes around 1 sec per object with the bigger ones taking up to 1 min and I have around 1000 of them total. The polycount however is rather low with 50 000 triangles total.
    Here's the base model

    And inside the cam view with clipping limits

    However the dxf file seems to be pretty high quality, I really like that related meshes get exported on blocks. The ceiling / floors are not manifold so I didn't expect the hatches to be consistent there.

    Here's for instance after putting some related blocks on specific layers

    Regarding layers, I agree that common layering system in Autocad & co is very different from how objects can be grouped in 3D softwares, especially considering BIM and its type oriented classification. Also, the collection system in Blender looks like a regular layer system but it is a lot more complex and powerful. Here's an example of how I implemented it :

    But it adds a lot of overhead in the addon code to handle all cases. :)

    brunopostle
  • Hi @Gorgious,
    the dxf exportation is the last operation (before deleting every newly created temporary object) so you should see the list of drawing time for every object.
    The crash doesn't seem related to the drawing process itself but to a very large amount of data that the add-on tries to store in the svg file: indeed, every svg stores the pixels occupied by the object in the rendered view (this way prj can compare the new scene with the previous one).
    Could you tell me the prj Scale, the prj LOD and the Orthographic scale of your camera?

    That's for sure: 1 sec for every object is a lot! 1 minute is an eternity!
    If your objects are not too much complex (and they are not for what I see) there should be something that causes this weird behaviour.
    For example this is the per-object drawing time for the attached drawing

    If you want to make some test you can make a new empty scene (with copy settings to keep the output path and the resolution) in the file and link in it just the camera and a few objects: then try to launch the drawing and send me the log (this way it shouldn't be too long).

    carlopav
  • Regarding layers, I agree that common layering system in Autocad & co is very different from how objects can be grouped in 3D softwares, especially considering BIM and its type oriented classification. Also, the collection system in Blender looks like a regular layer system but it is a lot more complex and powerful. Here's an example of how I implemented it...

    Thanks for the suggestion about the dxf layering system: I think it's not difficult to implement but, maybe, it could result in a more complex setting for the user. Let me think about it

  • @duncan said:
    @bitacovir I would love your comments as well - or just edit the explanation - it's mostly us two who make new software pages.

    I think it is very good explanation.

    duncan
  • Have there been discussions with @Moult on how all of this great functionality could be part of BlenderBIM rather than (yet another) separate Blender Plugin? It seems to me that the way forward for Blender as a tool for AEC is not more and more separate and uncoordinated plugins - it's consolidation of effort and deep integration between functionality. This argument is of course valid for many plugins, but you're here to talk to and your plugin is very new. So now must be the best time for me to try and convince you. :-)

    strumetCadGiru
  • Hi @duncan and thanks for your invitation to make prj part of BlenderBIM. You don't have to convince me: I always thought that BlenderBIM is the obvious landing place for prj.
    As I said before prj was born to respond to an immediate need I had in my everyday job. In order to do that, I took the shortest path taking advantage of those blender's functionalities that was already there (notably lineart and grease pencil svg exporter).
    That was easy enough to implement for my very poor developing skills. But generating drawing from IFC is a very tough (and perfectly right) goal and I'm not sure I have the abilities to be helpful in this task.
    Anyway I'm here and I'm absolutely available to help as far as I can: how can we proceed?

  • @strumet said:
    how can we proceed?

    That's the big question! I think what @Moult often says is have a look through the bug tracker and roadmap and see if there's something there that looks interesting to work on.

  • Hi, here is my thoughts for what they are worth... I like .prj and I like the vision of an SVG export that contains links back to the IFC. I think both are needed and will make a rich and flexible architectural workflow. I note that with Blender 3.2 Collections can now be Assets, nice to drag in elevations, sections and plans ortho cameras and use for .prj

    strumet
  • Alright I've run a bit more tests on a slightly smaller project of mine. I think I understand why I didn't get the regular output last time, because I was launching the addon from VScode. When I run it directly from Blender today with the system console it outputs fine. Objects are relatively fast to export.

    I tested the different LODs to see what's up. I see there's a page about camera settings on the wiki so I'd be thrilled to understand what exactly is the difference between the different LOD settings.

    My model is a water tower, 75k Triangles, roughly 150 objects. I noticed it bugged out with my working file so I applied all modifiers so everything is plain geometry with no evaluation shenanigans.

    Export time :
    LOD 0 : 6 sec
    LOD 1 : 15 sec
    LOD 2 : 22 sec
    LOD 3 : 54 sec
    LOD 4 : I think I ran out of memory after a few minutes.

    I expected some problems since some of my meshes are not manifold but all in all the hatching is pretty consistent, apart from the lower left where it joined two areas that should not be solid. This alone is ought to save me a bunch of time, so I'm already happy with the result.

    I did not notice much difference between the different LODs, apart from some small objects not being rendered in LOD0. Here's a side by side comparison between LOD0 (blue) and LOD1 (red). LOD 2 and 3 did not add any details AFAICT.

    I think the last I would wish from the export file is the intersections between objects, like here


    And the ability to customize layers a bit more :)

    Also, regarding merging the feature with the blenderbim addon, I think it is a great idea, but please keep an option to export things with 2 or 3 clicks like it is now, it's really convenient ! On most projects I can't afford to spend an entire day setting up an ifc project to export my plans.

    Cheers !

    strumet
  • @duncan said:
    That's the big question! I think what @Moult often says is have a look through the bug tracker and roadmap and see if there's something there that looks interesting to work on.

    Hi @duncan,
    I need some time to catch up with the drawing mechanisms of BlenderBIM (I'm going to read the long discussion on the issue #1153) in order to be "on board" on this topic.
    In the meantime do you have some quick tutorial about drawing generation in BlenderBIM to suggest?
    I also think that, maybe, we should think to some kind of strategy to gradually merge prj into BlenderBIM: this way we could keep prj's functionalities immediately working and usable by users and, meanwhile, we could work on the code while receiving useful feedbacks and suggestions from users as @Nigel and @Gorgious already did (thanks guys for you precious opinions!)


  • Hi @strumet I set up some standard views ortho camera, plans sections elections. It would be awesome to batch export to SVG rather than one at a time, what do you think?

  • Wow @Gorgious! Nice drawing! Your tests are very valuable for me. Thanks so much for that!

    I tested the different LODs to see what's up. I see there's a page about camera settings on the wiki so I'd be thrilled to understand what exactly is the difference between the different LOD settings.>
    ...
    I did not notice much difference between the different LODs, apart from some small objects not being rendered in LOD0. Here's a side by side comparison between LOD0 (blue) and LOD1 (red). LOD 2 and 3 did not add any details AFAICT.

    You're perfeclty right!
    Generally you can keep the LOD to 0 or 1 and raise it only if some very tiny objects in the scene are not drawn. Here's how it works: prj makes some flatten colors rendering (no antialiasing) in order to check objects visibility and keep track of their position *. The LOD define the amplitude of the resolution of these renderings:

    • LOD = 0 -> every square millimeter at the output scale can contain just 1 object
    • LOD = 1 -> every square millimeter at the output scale can contain up to 4 object
    • LOD = 2 -> every square millimeter at the output scale can contain up to 16 object
    • LOD = 3 -> every square millimeter at the output scale can contain up to 64 object
    • LOD = 4 -> every square millimeter at the output scale can contain up to 256 object (probably it's better to cut away this one and the previous one)

    * This way you can redraw just the objects that has been edited and update existent drawings quickly (at the moment it works for svg only)

    My model is a water tower, 75k Triangles, roughly 150 objects. I noticed it bugged out with my working file so I applied all modifiers so everything is plain geometry with no evaluation shenanigans.

    That's odd: prj should apply all object's visual transformations (like modifiers). Could you tell me which are the modifiers that generate the error?

    I think the last I would wish from the export file is the intersections between objects, like here

    About intersections I think I could work on it: lineart is already capable to calculate intersections between objects but only for collections or scenes while prj generate a lineart for every single object... I'll have to figure out how to solve this. In the meantime you could try creating real intersections objects (i.e. by boolean operations or Intersect(Knife)) and add them to the scene to draw (maybe I should make a little video to explain how to do it).

    Gorgious
  • @Nigel said:
    Hi @strumet I set up some standard views ortho camera, plans sections elections. It would be awesome to batch export to SVG rather than one at a time, what do you think?

    Hi @Nigel,
    in the earlier stages of development prj worked like this, indeed.
    Then I removed this feature to allow partial redrawing: selecting just one camera and the objects you want to update... with multiple cameras it resulted in a more complex situation for the user.
    Anyway I think I could make some tweak to the code and allow to automate the drawing procedure by external scripts. This way you should be able to easily launch multiple drawings at once.
    I'll let you know when it's ready (I think it will be possible with version 0.0.9, while today I released prj v0.0.8, which add imperial units support).

    Nigel
  • I'd like to recall that to address bug reports, questions, feature requests you can use the issue page of the prj repository: this way every problem - and every solution - will be easier to find for other users

    NigelBedson
  • @strumet said:
    I need some time to catch up with the drawing mechanisms of BlenderBIM (I'm going to read the long discussion on the issue #1153) in order to be "on board" on this topic.
    In the meantime do you have some quick tutorial about drawing generation in BlenderBIM to suggest?

    Sorry, I'm a power-supporter and barely even a user. My life is too full of other things. @SigmaDimensions @condur @Moult what are the best learning resources just now? And are there links to them from https://wiki.osarch.org/index.php?title=BlenderBIM_Add-on#External_Resources

  • @Gorgious said:

    Also, regarding merging the feature with the blenderbim addon, I think it is a great idea, but please keep an option to export things with 2 or 3 clicks like it is now, it's really convenient !

    Exactly my view! BlenderBIm integration would be great and needed but should keep a standalone version too for quick conceptual exports!

    strumet
  • edited June 16

    @Nigel said:

    Hi @strumet I set up some standard views ortho camera, plans sections elections. It would be awesome to batch export to SVG rather than one at a time, what do you think?

    Hi @Nigel,
    I added multiple cameras support.
    The feature will be in the next release but if you'd like to try it already you can find a pre-release here attached.
    And thanks for your help!

    NigelGorgious
  • I think this video is still useful to get started with drawings in BlenderBIM:

    strumet
  • edited June 19

    @bruno_perdigao said:
    I think this video is still useful to get started with drawings in BlenderBIM:

    Unfortunately i dont think that video is good to start on. I had the same path and it turned out the creation and modelling features in that video are obsolete now.

  • @strumet said:

    @Nigel said:

    Hi @strumet I set up some standard views ortho camera, plans sections elections. It would be awesome to batch export to SVG rather than one at a time, what do you think?

    Hi @Nigel,
    I added multiple cameras support.
    The feature will be in the next release but if you'd like to try it already you can find a pre-release here attached.
    And thanks for your help!

    @strumet
    Nice! that is especially useful.
    Thank you so much

    strumet
  • @Constantinesis said:
    I had the same path and it turned out the creation and modelling features in that video are obsolete now.

    They are very obsolete

  • @Constantinesis said:

    @bruno_perdigao said:
    I think this video is still useful to get started with drawings in BlenderBIM:

    Unfortunately i dont think that video is good to start on. I had the same path and it turned out the creation and modelling features in that video are obsolete now.

    I was referring to the drawing features specifically. I was able to reproduce some of the steps shown in this video.

  • Hello @strumet , FWIW the meshes that did not export were mesh instances resulting from a geometry nodes tree. They do not get instantiated by the Convert to > Mesh operator if the instances or not "Realized". My solution is to add a "Realize Instances" node tree to every object dealing with instances before evaluation.

    Also, setting the scale any lower than 1:50 causes some kind of overflow and the export process never finishes. Might be a "me" problem though.

    Cheers

  • Thanks @Gorgious.
    Actually, I didn't consider the meshes that are resulted from a geometry nodes tree. My bad. I need to fix it in future versions.
    About the scale problem it's probably caused by the rendering process I told you in my previous post. I should figure out another way to determine objects visibility. Anyway, if you are not interested in svg drawings (which are actually scaled), you can keep the scale at a low value (like 1:200 or 1:100): as a matter of fact, dxf or dwg are always drawn 1:1

    GorgiousCadGiru
  • Hello there @strumet ,

    I've submitted a PR to be able to copy prj settings between different objects.

    https://gitlab.com/marzof/prj/-/merge_requests/1

    I think this kind of solves my other issue https://gitlab.com/marzof/prj/-/issues/4

    Cheers

  • Thanks Gorgious,
    Wow, I'm really impressed! Let me check your PR (in gitlab they are called MR, as merge request) in order to merge it.
    Anyway I have to apologize for the delay in replying to your issues: I didn't receive any notification from gitlab...
    In the meantime I fixed the issue #3 about same block name in a cad drawing. I hope it's working now.

  • edited July 21

    Perfect!
    I merged your MR: now prj v0.0.9b contains both fixes to your issues.
    Thank you so much!

Sign In or Register to comment.