Importing DWG Sketchup 2019

,

If there are no more reports of this problem from other SU2019 users in Mac, maybe another cause should be sought.

I can import it on my Mac without any issues. Seems to be something specific to your computer or perhaps the extensions you have loaded in SketchUp.

It hadn’t occurred to me that extensions might affect the basic working mechanisms of SU. Is that truly a possibility? It would make me think hard about installing new extensions.

Fair point.

There are extensions that use Observers to swing into action in the background every time you do anything to the model. They don’t “affect the basic working mechanisms of SU” per-se, but they attempt follow-up actions that may crash SketchUp. The Trimble team can tell from the BugSplat report whether the crash was triggered by a misbehaving extension, though it is usually not possible to determine which one is guilty. If you PM me a crash report I may be able to offer some insight about why SU is crashing (though not having access to the SU source, it will be subject to guesswork).

@simoncbevans

Do you happen to have the Layers Organizer extension installed?
With this extension active, I see the dwg import crash as well… but with the extension deactivated, the dwg imports successfully without the crash

CD

2 Likes

It also fails to upload in Trimble Connect.
The picture @mihai.s showed 6 layers imported, but there are not any in SketchUp.
We do see import-dwg-failures on Mac when a Layer is called ‘0’ in the dwg

I meant you, @simoncbevans :slight_smile:

I do. And it wasn’t installed in my SU 2016 plugins folder so you may have pinpointed the problem. Should the developer be made aware of this issue?

How do I retrieve it? This is what the standard response says and does give a reference.

31

@ChrisDizon may have solved it though.

Crash reports are located at

~/Library/Logs/DiagnosticReports/

Ones relayed by BugSplat will have extension .bugsplat.log. Ones captured by macOS will have extension .crash. Since BugSplat just packages and relays the macOS report, there will often be one of each for the same crash. But when a crash happens without BugSplat catching it (which occurs if the app traps an error and aborts itself) there will be just a .crash. The report names contain the app and date/time of the crash.

Have tried PMing you but I’m told I cannot upload files of that type. Is there a workaround?

zip it and upload that.

Just for the record, I deleted Layers Organizer, closed and re-opened SU 2019 and hey presto, problem gone. I can now import the DWG like everyone else.

As I don’t use the extension that much (though I wish similar functionality were built into SU), the obvious answer is to live without it.

Thanks to @ChrisDizon for the fix.

For the record, @simoncbevans PM’d me the crash report and it was definitely in a Ruby extension. So @ChrisDizon’s fix is right on the money.

Really? That would mean every DWG file in the world. Just like in SketchUp, Layer 0 is the “default” layer in AutoCad and cannot be deleted.

We have reached out to the developer about the issue

2 Likes

stripping the layers for imports is not a good idea…

the geometry can be moved into groups, the group assigned to that layer and then have layer associations fixed…

LayerWatcher may also remove layers after imports [@TIG??] …

john

To remove all layers from selected geometry, or from geometry within selected ‘containers’ [component-instances and groups] - my LayerWatcher does have a context-menu tool ‘Selected-Geometry-To-Layer0’…

It also has several other useful layer-based tools too !

This snippet will gather ungrouped edges and faces by their assigned layer, create a group for each layer, transfer the entities to that group, and then reset them to use layer0 within the group. I wrote it to clean up models imported from CAD that use layers incorrectly for SketchUp. It preserves the structuring implied by the CAD layers but in a SketchUp-compatible way.

  # gather up loose edges and faces
  loose_faces = Sketchup.active_model.entities.grep(Sketchup::Face)
  loose_edges = Sketchup.active_model.entities.grep(Sketchup::Edge)
  # retain only edges not used by any face.  Edges needed by a face
  # will be handled along with the face.
  loose_free_edges = loose_edges.delete_if {|edge| !edge.faces.empty?}
  loose_geometry = loose_faces + loose_free_edges
  
  # Hash with a key for each layer used by loose geometry and value
  # an array of entities that use that layer.  Default initializes a
  # empty array so we can append items.
  loose_by_layer = Hash.new {|h,k| h[k] = []}
  loose_geometry.each {|entity| loose_by_layer[entity.layer] << entity}

  # create a group for each used layer and put the associated geometry
  # into it.  Because a face must have all its edges in the same context,
  # this will do two things: it will bring the bounding edges of the face
  # into the group even if they weren't using this layer, and it will create
  # a duplicate in the model if the edge is needed to bound a face still there.
  # These new edges in model aren't in the list we built earlier but aren't needed
  # because we captured only faces and free edges, not edges that bound faces.
  Sketchup.active_model.start_operation("Group by layer", true)
  loose_by_layer.keys.each do |layer|
    begin
      gp = Sketchup.active_model.entities.add_group(loose_by_layer[layer])
      # use the layer from the original loose entities for the group
      gp.layer = layer
      # and fix the Layer0 association of the ones in the group
      gp.definition.entities.each {|entity| entity.layer = nil}
    rescue => e
      # note: this reports the exception but lets the method
      # continue to process the rest of the layers
      UI.messagebox(e.message)
      puts e.message
      puts e.backtrace
    end
  end
  Sketchup.active_model.commit_operation
  nil
2 Likes