Coder Social home page Coder Social logo

thomthom / solid-inspector Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 2.0 5.85 MB

Inspect and repair solid groups and components in SketchUp.

Home Page: https://extensions.sketchup.com/en/content/solid-inspector%C2%B2

License: MIT License

Ruby 82.88% CSS 4.64% HTML 3.36% JavaScript 9.12%
sketchup extension solid manifold repair analyse

solid-inspector's Introduction

Solid Inspector for SketchUp

Requirements for Version 2

  1. SketchUp 2014 or newer.
  2. Internet Explorer 9 or newer for Windows systems.

Requirements for Version 1

  1. SketchUp 6 or newer.
  2. TT_Lib² 2.7 or newer

Guide for Contributing

Download

License

The MIT License (MIT)

See the LICENSE file for details.

solid-inspector's People

Contributors

macfreek avatar thomthom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kubasimov ferfu

solid-inspector's Issues

Nested inspection: limit the execution time.

Original report by me.


https://bitbucket.org/thomthom/solid-inspector/pull-requests/1/examine-nested-instances/diff#comment-57884718

Optionally: somehow limit the execution time. For a complex model, finding errors in all subgroups may take a while. To make matters words: I found myself trying to cancel a lengthy process by pressing 'escape' key on my keyboard. The result was that Sketchup responded by selecting the parent of the currently active group, and with that, it also automatically start a new find_error process, but now for a parent, so that it only takes longer. Woops. Not what I expected to happen.

comparison of Sketchup::Edge with Sketchup::Edge failed

Original report by me.


http://sketchup.thomthom.net/extensions/report/15

#<ArgumentError: comparison of Sketchup::Edge with Sketchup::Edge failed>

C:/Users/MajorTwip/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/shell.rb:204:in `each'
C:/Users/MajorTwip/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/shell.rb:204:in `min'
C:/Users/MajorTwip/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/shell.rb:204:in `find_start_face'
C:/Users/MajorTwip/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/shell.rb:43:in `block in resolve'
C:/Users/MajorTwip/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/shell.rb:117:in `find_geometry_groups'
C:/Users/MajorTwip/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/shell.rb:42:in `resolve'
[...]

Whaaat?

    # @param [Sketchup::Entities] entities
    # @param [Boolean] outside
    #
    # @return [Sketchup::Face, Nil]
    def find_start_face(entities, outside)
      # Ignore vertices with no faces attached.
      vertices = Set.new
      entities.grep(Sketchup::Edge) { |edge|
        vertices.merge(edge.vertices)
      }
      vertices.delete_if { |vertex| get_faces(vertex).empty? }
      return nil if vertices.empty?

      # 1) Pick the vertex (v) with max z component.
      max_z_vertex = vertices.max { |a, b|
        a.position.z <=> b.position.z
      }

      # 2) For v, pick the attached edge (e) least aligned with the z axis.
      edges = max_z_vertex.edges.delete_if { |edge| get_faces(edge).empty? }
      edge = edges.min { |a, b|
        edge_normal_z_component(a) <=> edge_normal_z_component(b)
      }

      # 3) For e, pick the face attached with maximum |z| normal component.
      face = get_faces(edge).max { |a, b|
        face_normal(a).z.abs <=> face_normal(b).z.abs
      }

      # 4) reverse face if necessary.
      if outside
        reverse_face(face) if face_normal(face).z < 0
      else
        reverse_face(face) if face_normal(face).z > 0
      end

      face
    end


    # @param [Sketchup::Edge] edge
    #
    # @return [Float]
    def edge_normal_z_component(edge)
      edge.line[1].z.abs
    end

False External Faces were detected

False External Faces were detected:

image
example1.zip

most probably because Roof & Bay Window intersection does not create a new face on the roof:
image
but I don't see any way to detect and fix such situation

Non-splitting entities overlapping/intersecting

Original report by me.

The original report had attachments: badgerace.skp

badgerace.zip


When geometry intersects/overlaps without splitting each other there results can be false positives.

In the attached badgerace.skp it detects false positives for reversed faces and doesn't detect internal faces. Probably because the missing splits of the intersecting geometry cause the mesh to be non-manifoldable.

Extensions interfere with JSON module

Original report by me.


SU Walk:

After installing:

String.instance_method(:to_json).source_location
["c:/programdata/sketchup/sketchup 2016/sketchup/plugins/su_walk/plug_in/sketchup_json.rbs", 264]

Logged error report:

http://sketchup.thomthom.net/extensions/TT_SolidInspector2/reports/report/1441

#<SketchUpJSON::JSONEncodeError: This hash can not generate valid JSON>

c:/programdata/sketchup/sketchup 2016/sketchup/plugins/su_walk/plug_in/sketchup_json.rbs:316:in `validate_key!'
c:/programdata/sketchup/sketchup 2016/sketchup/plugins/su_walk/plug_in/sketchup_json.rbs:307:in `block in to_json'
c:/programdata/sketchup/sketchup 2016/sketchup/plugins/su_walk/plug_in/sketchup_json.rbs:306:in `each'
c:/programdata/sketchup/sketchup 2016/sketchup/plugins/su_walk/plug_in/sketchup_json.rbs:306:in `collect'
c:/programdata/sketchup/sketchup 2016/sketchup/plugins/su_walk/plug_in/sketchup_json.rbs:306:in `to_json'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:60:in `block in call'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:60:in `map'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:60:in `call'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:590:in `update_webdialog'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:257:in `analyze'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:403:in `block in create_window'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:95:in `call'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:95:in `block in trigger_events'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:94:in `each'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:94:in `trigger_events'
C:/Users/Lichen Intern/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/tt_solid_inspector2/window.rb:35:in `block in initialize'
SketchUp:1:in `call'

undefined method `model' for nil:NilClass

Original report by me.


http://forums.sketchup.com/t/solid-inspector/5117/91?u=thomthom

#!ruby

#<NoMethodError: undefined method `model' for nil:NilClass>
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/error_finder.rb:185:in `fix_errors'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:472:in `fix_all'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:390:in `block in create_window'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:95:in `call'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:95:in `block in trigger_events'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:94:in `each'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:94:in `trigger_events'
C:/Users/Jake/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:35:in `block in initialize'
SketchUp:1:in `call'

943494934-046c378bd843c423

Detect mangling of the Set class

Original report by me.


So this just happened:

#!text

Error: #<NoMethodError: undefined method `<<' for #<Sketchup::Set:0x0000001605eb80>>
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/error_finder.rb:48:in `block in find_errors'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/error_finder.rb:34:in `each'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/error_finder.rb:34:in `grep'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/error_finder.rb:34:in `find_errors'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:159:in `analyze'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/inspector_tool.rb:186:in `block in create_window'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:95:in `call'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:95:in `block in trigger_events'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:94:in `each'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:94:in `trigger_events'
C:/Users/hp/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/tt_solid_inspector2/window.rb:35:in `block in initialize'
SketchUp:1:in `call'

Someone applied the shim in the global namespace. Might want to detect this and present a user warning.

General Issue

Original report by me.


(TODO: Split into separate issue!)

Now select some or all of the right rectangle. A face, an edge, all, it doesn't matter. Run Solid Inspector. Nothing shows up. The bottom says to use the arrow keys. They do nothing. Click on the right rectangle. Nothing. The only indication that you are even running SI is the grayed select arrow (and the prompt at the bottom). Click on the left (grouped) rectangle. It shows a big red circle (this is good). The bottom prompt reads "Click on solids to inspect." Click on the right rectangle. Nothing happens. In fact, click anywhere; nothing happens. Click outside to clear SI mode. You can't. (But you should, IMHO. It should go to Select.)

Second test. Click outside of either rectangle so that neither is selected. Enter SI mode. This time the right rectangle has the red circle. Click on the left rectangle. The circle moves to the left (so far, so good). Click on the right. Nothing happens. (not good).

Using ^Z/^Y undo/redo causes other (but generally predictable) weirdness. This doesn't bother me, and the "fix" might be worse than the current behavior, so fine to leave this alone.

Attempt to resolve shell regardless

Original report by me.


Try to resolve a shell even if there are border edges found. The border edges might be part of the interior and irrelevant.

This should be done after #24 has been addressed as otherwise there will be false positives detected.

Implement new error reporter

Original report by me.


Replace the current error reporter with a new one which report errors to a server back end. This should simplify error reporting for the user and provide better and more useful information.

Solid or not Solid?

Original report by me.

The original report had attachments: 2016-05-18_11h18_56.png

2016-05-18_11h18_56


It looks to be tripped up by an edge connected to more than 2 faces. SI2 tries to detect for instance if two cubes are sharing an edge and allow that as a Solid. Might want to add an option to turn that on/off. Though I'm not sure how trivial that would be with the new algorithm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.