pushpull face on a cube

pushpull face on a cube

Postby biervat » Tue Apr 25, 2017 1:28 pm

In my script I want to pushpull a newly created face on a side of a cube. When an edge of the face coincide with the edge of the cube the resulting group isn't a solid group. I don't have this problem when the edges don't coincide. What am I doing wrong?

Code: Select all
# create cube
subelement.entities.add_face(pointscube).pushpull(height)
# create face on side of cube
face = subelement.entities.add_face(points)
face.pushpull(isolatie + binnenschil)
0

biervat 
 

Re: pushpull face on a cube

Postby TIG » Tue Apr 25, 2017 1:46 pm

Your explanation is not that clear.

In your screenshot assume that the flat slab and new block would both be solid if they didn't share an edge, e.g. if they were made as separate groups.
However, sharing an edge means that the shared edge supports four faces.
A solid's edges must all support two faces - no fewer and no more.

Try this manually to see the issue.

You are doing nothing 'wrong' - you are simply making something that can never be a solid ??
0
TIG
User avatar
TIG 
Global Moderator
 

Re: pushpull face on a cube

Postby biervat » Tue Apr 25, 2017 1:55 pm

Sorry for my explanation but english isn't my first language.
I first create a plane inside a group and pushpull it. This is the slab in the picture.
Then I create a face inside the same group. But when I pushpull this one it creates a new cube touching the slab. When I manually delete the mutual face it becomes a solid group.

Both objects in the picture are created with the same script.
0

biervat 
 

Re: pushpull face on a cube

Postby TIG » Tue Apr 25, 2017 7:20 pm

If you cut a cross-section through the two objects you should find that the 'good' one has no internal partitions - but the 'bad' one probably leaves an internal partition face because of the edge that the rectangle shares with another face...

To trap for these odd events you probably need to model in a context - e.g. a group - then inspect the faces after the pushpull.

You can do a raytest from the each [new] face.bounds.center using the face.normal...

If it hits another face that is in the same context then it's probably the partition, erase it.

OR perhaps, before doing the pushpull get the face's data = face.plane, face.normal and face.bounds... .max/.min/.diagonal/.center etc...
Then inspect the new faces after the pushpull and if there's a face that's an exact match to that face data, then you can erase it ?

Do some test to see if this works...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: pushpull face on a cube

Postby biervat » Wed Apr 26, 2017 9:57 am

Thanks that did the trick. Is there a reason why the face isn't removed by the pushpull command?

Code: Select all
# create cube
subelement.entities.add_face(pointscube).pushpull(height)
# create face on side of cube
face = subelement.entities.add_face(retourpoints)
fbounds = face.bounds
face.pushpull(isolatie + binnenschil)
subelement.entities.each do |ent|
  if ent.is_a?(Sketchup::Face)
   ebounds = ent.bounds
   if ebounds.max == fbounds.max and ebounds.min == fbounds.min
     ent.erase!
     break
   end
  end
end
0

biervat 
 

Re: pushpull face on a cube

Postby TIG » Wed Apr 26, 2017 12:17 pm

As I already explained...
And you can see this when it's done 'manually' too...
If a rectangle face is wholly within another planar face and none of its edges are shared with any other faces, then the PushPull leaves a hole where the original face was.
If a rectangle face has any edges shared with other faces - as in the case you have where the face is on the corner of the form and one edge has another non-planar face - then the PushPull can leave the original face behind in the new geometry...
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: vic123 and 1 guest

Visit our sponsors: