SketchUcation Plugin Store

 

 

.edges returns a face

.edges returns a face

Postby timwarner » Thu Jul 12, 2012 11:17 pm

I can't figure this one out. Here's the output from the Ruby Console:

> back
#<Sketchup::Face:0x1cbbfe74>
> back.edges.each{|e| puts e}
#<Sketchup::Edge:0x1cbc1850>
#<Sketchup::Edge:0x1cbc1a1c>
#<Sketchup::Face:0x1cbcfc84>
#<Sketchup::Edge:0x1cbc0cc0>
[#<Sketchup::Edge:0x1cbc1850>, #<Sketchup::Edge:0x1cbc1a1c>, #<Sketchup::Face:0x1cbcfc84>, #<Sketchup::Edge:0x1cbc0cc0>]

How can the .edges method return a Face?
timwarner
 
Posts: 20
Joined: Wed Dec 09, 2009 2:08 am
Name: Tim Warner

Re: .edges returns a face

Postby TIG » Fri Jul 13, 2012 1:21 pm

BUT
face.edges doesn't return a face, it does return an array of edges.
face=Sketchup.active_model.selection[0]
#<Sketchup::Face:0xef75e64>
face.edges
[#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]

or
face.edges.each{|e|puts e}
#<Sketchup::Edge:0xf0a8b10>
#<Sketchup::Edge:0xef75e78>
#<Sketchup::Edge:0xf0a8c28>
[#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]

Are you using the standard Ruby Console ?
Do you have any other tools that might ill-advisedly mess with the base-classes like Sketchup::Face ?
Your installation is most likely 'broken' :?
Have you considered reinstalling ?
TIG
User avatar
TIG
Global Moderator
 
Posts: 13917
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: .edges returns a face

Postby timwarner » Fri Jul 13, 2012 1:48 pm

TIG wrote:BUT
face.edges doesn't return a face, it does return an array of edges.
face=Sketchup.active_model.selection[0]
#<Sketchup::Face:0xef75e64>
face.edges
[#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]

or
face.edges.each{|e|puts e}
#<Sketchup::Edge:0xf0a8b10>
#<Sketchup::Edge:0xef75e78>
#<Sketchup::Edge:0xf0a8c28>
[#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]

Are you using the standard Ruby Console ?
Do you have any other tools that might ill-advisedly mess with the base-classes like Sketchup::Face ?
Your installation is most likely 'broken' :?
Have you considered reinstalling ?

Yes, it's the standard Ruby Console.
No, I have no other tools that mess with the base-class.
I'll re-install and see what happens.
Thx for the feedback.
timwarner
 
Posts: 20
Joined: Wed Dec 09, 2009 2:08 am
Name: Tim Warner

Re: .edges returns a face

Postby Jim » Fri Jul 13, 2012 9:39 pm

I'd be interested in seeing the model (or portion of) to see if it can be reproduced.
Jim
Global Moderator
 
Posts: 4126
Joined: Mon Nov 12, 2007 10:13 pm
Location: NEOH
Name: Jim
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: other
Level of SketchUp: Intermediate

Re: .edges returns a face

Postby Dan Rathbun » Fri Jul 13, 2012 11:47 pm

Tim, are you really still using SketchUp 8.0.4810 ??
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4069
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: .edges returns a face

Postby timwarner » Sat Jul 14, 2012 2:05 pm

I reinstalled SU and the problem went away, so it looks like TIG was correct. I'll have to check my backups to see what version of SU was running (it would have been current, though). The profile info was obsolete.
timwarner
 
Posts: 20
Joined: Wed Dec 09, 2009 2:08 am
Name: Tim Warner

Re: .edges returns a face

Postby kwalkerman » Sat Jul 21, 2012 11:06 pm

I did see something like that once before - I had a plugin that traced faces and did something like:

face.edges.each do |e|
# do something with an edge
end

... and every once in 10,000 faces, I'd see something like you're describing, although I could never reproduce it on command. This was with SU 7.0. I never found a fix - just found another way to execute the plugin.
kwalkerman
 
Posts: 135
Joined: Mon Feb 08, 2010 9:48 pm
Name: Karen

Re: .edges returns a face

Postby Dan Rathbun » Sat Jul 21, 2012 11:41 pm

kwalkerman wrote:I never found a fix - just found another way to execute the plugin.

Likely:
Code: Select all
face.edges.each do |e|
  next unless e.is_a?(Sketchup::Edge)
  # do something with an edge
end
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4069
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: .edges returns a face

Postby kwalkerman » Mon Jul 23, 2012 9:27 pm

Dan - the bug came immediately after:

if e.is_a? Sketchup::Edge

... it was very strange, and as I said, happened once in a great while - I couldn't figure out how to make it happen on command.
kwalkerman
 
Posts: 135
Joined: Mon Feb 08, 2010 9:48 pm
Name: Karen

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Vertex Tools for SketchUp. Take control over each vertex with this vertex editor for SketchUp.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012


Return to Developers' Forum

Who is online

Users browsing this forum: francescole, ktstl and 3 guests