how to know face contain another face with ruby api in sketchup
This can be determined by comparing the loops that make up the face.
Face.outerloop
will return the loop that bounds a face (excluding any internal edges). Face.loop
returns all of a face's loops including inner and outer.
So, by getting a list of all connected faces (using the example code with all_connected
that you posted), you can iterate over those faces to determine if any of faceA's outerloop
is shared by the iterated face. If so, it is not an inset face, rather it is adjacent.
There is an alternative method posted here that might be a good way to go too: https://forums.sketchup.com/t/how-to-know-that-a-face-contains-another-face-using-ruby-api/21840/3
Note, in the linked post, they comment that you can't directly compare loops, but you can compare edges (which compose a loop).
Is there any image recognation gem/ plugin for ruby on rails?
I haven't tried the library myself yet but
https://github.com/jeffrafter/ruby-opencv
has a short example code section on face recognition - although I think this is the source used for the RubyGem OpenCV (or at least a fork of the original), neither has been under development for quite a few years.
http://rubygems.org/gems/opencv
gem "opencv", "~> 0.0.7"
if you need more up-to-date features maybe try
https://github.com/amarburg/opencv-ffi
Although you will need to import the modules into your public folders (or whichever folder you are using to import external code from - it varies with Rails version), and then follow the example code.
Quickest Way to create Face and Edge objects in Sketchup
I found
add_faces_from_mesh
and
fill_from_mesh
to be much faster but I
end up with a mesh consisting of
Surface
instances instead of theFace
andEdge
objects I am looking for.
Calling add_faces_from_mesh
or fill_from_mesh
with the smooth_flags
parameter explicitly set to zero correctly constructs Face
and Edge
objects. Sketchup Documentation claims that smooth_flags
defaults to zero... my trials show otherwise.
Related Topics
Resize Svg When Window Is Resized in D3.Js
Rails Specify Load Order of JavaScript Files
Fire Greasemonkey Script on Ajax Request
How to Wait in Node.Js (Javascript)? L Need to Pause for a Period of Time
Explanation of [].Slice.Call in JavaScript
Angular4 - No Value Accessor for Form Control
Setting Innerhtml VS. Setting Value with JavaScript
JavaScript Function Leading Bang ! Syntax
Differencebetween Compile and Link Function in Angularjs
Is There an Internet Explorer Approved Substitute for Selectionstart and Selectionend
Shiny App:Disable Downloadbutton
Force Download an Image Using JavaScript
How to Check If Function Exists in JavaScript
How to Get an Ajax Get-Request to Wait for the Page to Be Rendered Before Returning a Response
How to Obtain the Query String from the Current Url with JavaScript