Exemple #1
0
    def create_reference_arr_by_dir(self, direction):
        faces = self.get_parallel_faces_by_dir(direction)

        ref_arr = DB.ReferenceArray()
        for face in faces:
            ref_arr.Append(face.Reference)

        logger.debug('Create ReferenceArray for {} face'.format(ref_arr.Size))
        return ref_arr
Exemple #2
0
geometry = dwg_link_instances[0].get_Geometry(geo_opt)

with db.Transaction("redraw dim_help layer dwg polylines"):
    for geo_inst in geometry:
        geo_elem = geo_inst.GetInstanceGeometry()
        for polyline in geo_elem:
            element = revit.doc.GetElement(polyline.GraphicsStyleId)
            if not element:
                continue

            is_target_layer = element.GraphicsStyleCategory.Name == LAYER_NAME
            is_polyline = polyline.GetType().Name == "PolyLine"
            if is_polyline and is_target_layer:

                begin = None
                for pts in polyline.GetCoordinates():
                    if not begin:
                        begin = pts
                        continue
                    end = pts
                    line = DB.Line.CreateBound(begin, end)
                    det_line = doc.Create.NewDetailCurve(active_view, line)
                    line_refs = DB.ReferenceArray()
                    geo_curve = det_line.GeometryCurve
                    line_refs.Append(geo_curve.GetEndPointReference(0))
                    line_refs.Append(geo_curve.GetEndPointReference(1))
                    dim = doc.Create.NewDimension(active_view,
                                                  det_line.GeometryCurve,
                                                  line_refs)
                    begin = pts