Simple shape example¶
Simple shape example¶
1# Simple example of using an IShape object
2
3# Use the shape impact.creator to create a shape from all the
4# entities in the active block. Note that the entities
5# must form one or more closed shapes, otherwise they will be ignored.
6
7ShapeCreator = impact.creator.shape_creator()
8ShapeCreator.entities = active_block.entities
9Shape = ShapeCreator.perform(ipShapeCreationType.sctEntities)
10
11# We ought to check that we haven't made an empty shape,
12# for example by having no entities.
13if Shape.subshape_count > 0:
14
15 # Make another shape by offsetting the first one
16 new_shape = Shape.offset_bigger(20, True)
17
18 # Now create entities from the shape, so that we can see it
19 new_entities = new_shape.copy_to_block(active_block)
20