problem with reference CAD drawings

edited July 2025 in General

Hi, I can't model with bonsaibim if I have a CAD reference drawing imported as dxf or svg. Even inserting a wall becomes impossible, the system slows down, jerks, and you can't work. Everything works fine if I turn off the reference drawing. I tried several versions of Blender 4 among the LTS versions. Same problem in all of them.
video
https://streamable.com/wwcwhp

Comments

  • edited July 2025

    Hmmh, I wonder ....

    • Could you model in pure Blender with the referenced CAD drawing active
    • which Blender Version
    • which Hardware and OS

    In the video the CAD drawing doesn't really too complicated ....
    EDIT :
    Looked a little closer when you selected the underlay. There are indeed lots of Vertices for curve tessellation. But strangely also for many of the straight lines.

  • It's not ideal, but as a troubleshooting measure, try and turn off all the following snaps to see if performance improves.
    Also too, is the cad file in "model space", or in a drawing as an IfcAnnotation?

  • @doubleboogieblues try also to transform curves into meshes, it should help

    theoryshawShegssteverugiBedson
  • And merge vertices by closest.

    Massimosteverugi
  • edited July 2025

    I am using version 4.2.12 LTS (Linux). I have an AMD W6600 Pro GPU with proprietary drivers. I also tried it on my laptop with an NVIDIA card, but I have the same problems. I tried removing the meshes, curves and hatches. The drawing is much lighter, but the result does not change much. Even if I convert it to a mesh, it is too slow to work with.
    Video
    https://streamable.com/vc3ect

  • edited July 2025

    I tested the same file on a Windows installation and everything works smoothly and quickly.
    I don't know if the problem is due to Bonsai malfunctioning on Linux or if it's a problem with the video drivers in Linux. It's strange because Blender works very well on my Linux installation, with no graphics issues.
    I don't know if anyone else has had similar problems with bonsai in Linux.

  • That's strange.
    Is it possible to upload that file ?

    Not sure if Linux or older Blender 4.2 LTS could be an issue. I use latest daily builds of Bonsai on Mac. But for me they only work with Blender 4.5 (LTS). Neither in Blender 4.4 nor 5.0.

  • Hmmh, I can't replicate any lags with your referenced drawing here on my M4. Wall Tool works real time.
    And as you tested not likely an AMD vs Nvidia driver issues either ...
    There is some Z-fighting on your Walls as the 2nd set of Walls in the other Story sits at the same height. But I could not imagine this could cause any problems.

  • I opened both files in separate instances of Bonsai. I copied and pasted the svg outline from the .blend into the ifc file. Then, in the ifc file, I switched to wall mode, and hit Shift-A to add. I confirm horrible lag.

    Turning snap off entirely did not help. I noticed that Bonsai does not seem to respect the global snap on/off setting. I saw it was still detecting mid-points, end-points etc, as denoted by the orange triangle, square, X shapes. Even deactivating as much of the Bonsai specific snaps did not help (or if it did, it was by a negligible amount.)

    It is strange why this particular object causes such slow-down though. My main project has objects with higher vertex count, and no slow-down.

    This is probably worth raising a bug for.

    My pertinent system info for OP to compare with:
    My system is a i7-7700HQ mobile quad core, intel/nvidia GTX 1050 optimus gfx, running Ubuntu 22.04 LTS.

    os: Linux
    os_version: #157-Ubuntu SMP Mon Jun 16 07:33:10 UTC 2025
    python_version: 3.11.11
    architecture: ('64bit', 'ELF')
    machine: x86_64
    processor: x86_64
    blender_version: 4.5.0
    bonsai_version: 0.8.4-alpha250716
    bonsai_commit_hash: f14b4c4
    bonsai_commit_date: 2025-07-16T16:36:16+05:00
    last_actions: 
    <snipped - not relevant>
    last_error: None
    ifc: modello.ifc
    schema: IFC4
    preprocessor_version: IfcOpenShell 0.8.3-post1
    originating_system: Bonsai 0.8.3-post1
    
    zoomer
  • edited July 2025

    I essentially did the same thing as @sjb007, but didn't experience any slow down.
    ...
    The one thing, but I don't think it's related, is to make sure to apply the following to the cad file, as I noticed it's scaled up 100 times.

    os: Windows
    os_version: 10.0.19045
    python_version: 3.11.7
    architecture: ('64bit', 'WindowsPE')
    machine: AMD64
    processor: Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
    blender_version: 4.2.9 LTS
    bonsai_version: 0.0.0
    bonsai_commit_hash: cfd5d2a
    bonsai_commit_date: 2025-07-25T16:57:40+05:00
    
    
  • Applied all transforms, still terribly slow.

  • edited July 2025

    my laptop information:
    EndeavorOS, KDE Plasma 6.4.2, Wayland, CPU Intel Core™ i7-4710HQ, GPU Nvidia Geforce GTX 860M, Driver 575.64.03
    os: Linux os_version: #1 SMP PREEMPT_DYNAMIC Thu, 10 Jul 2025 17:10:18 +0000 python_version: 3.11.7 architecture: ('64bit', 'ELF') machine: x86_64 processor: blender_version: 4.2.12 LTS bonsai_version: 0.8.3-post1 bonsai_commit_hash: None bonsai_commit_date: None last_actions: last_error: None ifc: modello.ifc schema: IFC4 preprocessor_version: IfcOpenShell 0.8.3-post1 originating_system: Bonsai 0.8.3-post1

    I'll give the open drivers a try.

  • my laptop information:
    EndeavorOS, KDE Plasma 6.4.2, CPU Intel® Core i7-4710HQ, GPU NVIDIA GeForce GTX 860M, Driver 575.64.03

    os: Linux
    os_version: #1 SMP PREEMPT_DYNAMIC Thu, 10 Jul 2025 17:10:18 +0000
    python_version: 3.11.7
    architecture: ('64bit', 'ELF')
    machine: x86_64
    processor: 
    blender_version: 4.2.12 LTS
    bonsai_version: 0.8.3-post1
    bonsai_commit_hash: None
    bonsai_commit_date: None
    last_actions: 
    last_error: None
    ifc: modello.ifc
    schema: IFC4
    preprocessor_version: IfcOpenShell 0.8.3-post1
    originating_system: Bonsai 0.8.3-post1
    

    I'll try with the open drivers

  • Hmm. Well I had a fun diversion. Tried to update my gfx card drivers, and made a right mess of my system. Took ages to fix it. One tidbit I came across while trying to fix it was that a generic blender report about lag in Linux. The cause was explained as Linux sending many more mouse events. I've seen this myself when I contributed to the Terminator terminal application where dragging a splitter bar would swamp the code with events that caused constant resizing of the vte. I implemented a deferring of the vte sizing, only processing the latest. It went from laggy to smooth as butter.
    I wonder if this is something similar, but I think the code by @brunopostle might be a bit beyond me to figure out. The common denominator between me and @doubleboogieblues is Linux.

    Johnzoomer
  • edited July 2025

    @sjb007 said:
    I opened both files in separate instances of Bonsai. I copied and pasted the svg outline from the .blend into the ifc file. Then, in the ifc file, I switched to wall mode, and hit Shift-A to add. I confirm horrible lag.

    OK, initially I just tested the Blend File, not the IFC, on Mac and had no issues ....
    So now I tested again by opening the Blend File but also loading the IFC file. And .... still no issues.

    So for fun I started my PC with Linux ElementaryOS, Blender was still 4.4.3.
    Also opened Blend and loaded IFC in.
    And ..... I can confirm it heavily lags initially after starting Add Wall.

    Then I could continue drawing Walls. Repeat Add Wall and it lags again, while showing a strange (error) cursor symbol. And it feels like, with every further attempt, initial lag gets worse and continuing Walls also gets temporarily laggy.

    (Ryzen 3950X, AMD XT 6800 16 GB VRAM with standard Mesa driver, 64 GB RAM. ElementaryOS is basically a Ubuntu with their Pantheon Desktop)

  • Based on profiler described here: https://community.osarch.org/discussion/2951/blender-bonsai-start-up-time
    Any chance someone on Windows (or Mac) could install the Blender add-on profiler here https://extensions.blender.org/add-ons/addonprofiler/
    Just open the ifc file on its own, start the profiler, Shift-A as if you were going to add a wall, move the mouse around a bit, hit escape (don't actually add anything), then stop the profile, and save it to a .prof file.
    Now repeat the above with the two following changes. First, copy the outline object from the .blend file first. Second, hit Clear in the profiler before capturing (otherwise the file would contain both with and without the outline object.)
    Then attach them here so I can compare the captures with my Linux ones where I see the problem.

  • Hmmm. On a hunch I changed https://github.com/IfcOpenShell/IfcOpenShell/blob/7cd423d4235972096c7e407a9b2d3ae2dae31bc8/src/bonsai/bonsai/bim/module/model/polyline.py#L917 from:
    if event.type == "MOUSEMOVE": or event.type == "INBETWEEN_MOUSEMOVE":
    to:
    if event.type == "MOUSEMOVE":
    The functionality seems pretty much the same, although the smoothness is gone. The tool is much more useable in this curious case.

  • My apologies for earlier where a attributed the code to @brunopostle, it is by @bruno_perdigao.

    brunopostle
  • @sjb007 said:
    Any chance someone on Windows (or Mac) could install the Blender add-on profiler

    OMG, now I see the same lagging on macOS too !

  • Hi guys, I spotted the issue but I’ll take some time to solve it. I’ll let you know when it’s done.

    zoomersjb007steverugidoubleboogiebluessemhustej
  • I tested the file on my 10 year old Windows notebook. I have no lag creating a wall using snaps.

    • Processor Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz 2.50 GHz
    • Blender 4.2.1
    • Bonsai 0.8.3

    Tom

  • I was able to reproduce this issue on Linux. It seems to be related to how the snapping system works. Raycast operations are costly, so we created an optimization filter to only raycast objects that are on the screen and close to the mouse. These operations must be performed every time you move the mouse or change the view. The filter ensures that we avoid unnecessary calculations. However, in @doubleboogieblues's file, we have a single object with many vertices (which is a common case when working with CAD reference), so the filter is ineffective; it only works at the object level, not the mesh level. To snap that object, it must process all the vertices and edges, which is causing the lag.
    We need to create another filter that operates at the mesh level, which I am currently working on, but I don't have a time estimate yet.
    In the meantime, a possible fix is to split the object into multiple objects. While this is not the most convenient solution, it may serve as a useful workaround. Use the script below with the object (path1042) selected:
    Video: https://imgur.com/a/WEmxlzt

    import bpy, bmesh
    
    obj = bpy.context.active_object
    
    bpy.ops.object.mode_set(mode='EDIT')
    
    bm = bmesh.from_edit_mesh(obj.data)
    
    bmesh.ops.split_edges(bm, edges=bm.edges)
    
    bmesh.update_edit_mesh(bpy.context.object.data)
    
    bpy.ops.mesh.separate(type='LOOSE')
    bpy.ops.object.mode_set(mode='OBJECT')
    
    sjb007zoomerMassimoduarteframossemhustejdoubleboogieblues
  • @bruno_perdigao thanks for explanation...but why this happens only on linux?

  • but why this happens only on linux?

    When I tried the exact workflow as described here :

    @sjb007 said:
    Just open the ifc file on its own, start the profiler, Shift-A as if you were going to add a wall, move the mouse around a bit, hit escape (don't actually add anything).
    Now repeat the above with the two following changes. First, copy the outline object from the .blend file first..

    I got the same lag on my M4 MBP too.
    I think it is basically a Blender thing, on all platforms.

  • @zoomer said:
    I think it is basically a Blender thing, on all platforms.

    People specifically say they cannot reproduce on Windows. Mac has more in common with Linux, than it does Windows, so... ¯\_(ツ)_/¯

  • Same issue here on an Apple M4Pro Mini.

Sign In or Register to comment.