def create_pattern(self, domain, export_only=False, export_path=None): # cleanup selection (pick only acceptable curves) self.selected_lines, self.selected_fillgrids = \ self.cleanup_selection(self._selection, for_model=self.is_model_pat) line_tuples = [] for det_line in self.selected_lines: geom_curve = det_line.GeometryCurve if type(geom_curve) in accpeted_curves: tes_points = [tp for tp in geom_curve.Tessellate()] for xyz1, xyz2 in pyutils.pairwise(tes_points, step=1): line_tuples.append(self.make_pattern_line(xyz1, xyz2)) elif isinstance(geom_curve, DB.Line): line_tuples.append( self.make_pattern_line(geom_curve.GetEndPoint(0), geom_curve.GetEndPoint(1))) call_params = 'Name:{} Model:{} FilledRegion:{} Domain:{}\n' \ 'Lines:{}\n'\ 'FillGrids:{}'\ .format(self.pat_name, self.is_model_pat, self.create_filledregion, domain, line_tuples, self.selected_fillgrids) logger.debug(call_params) if not self.is_model_pat: pat_scale = 1.0 / revit.activeview.Scale else: pat_scale = 1.0 if export_only: patmaker.export_pattern( export_path, self.pat_name, line_tuples, domain, fillgrids=self.selected_fillgrids, scale=pat_scale * self.export_scale, model_pattern=self.is_model_pat, allow_expansion=self.highestres_cb.IsChecked) forms.alert('Pattern {} exported.'.format(self.pat_name)) else: patmaker.make_pattern(self.pat_name, line_tuples, domain, fillgrids=self.selected_fillgrids, scale=pat_scale, model_pattern=self.is_model_pat, allow_expansion=self.highestres_cb.IsChecked, create_filledregion=self.create_filledregion) forms.alert('Pattern {} created/updated.'.format(self.pat_name))
def create_pattern(self, domain, export_only=False, export_path=None): # cleanup selection (pick only acceptable curves) self.selected_geom_curves, self.selected_fillgrids = \ self.cleanup_selection(self._selection, for_model=self.is_model_pat) line_tuples = [] for geom_curve in self.selected_geom_curves: if isinstance(geom_curve, acceptable_curves): tes_points = [tp for tp in geom_curve.Tessellate()] for xyz1, xyz2 in pyutils.pairwise(tes_points, step=1): line_tuples.append(self.make_pattern_line(xyz1, xyz2)) elif isinstance(geom_curve, DB.Line): line_tuples.append( self.make_pattern_line(geom_curve.GetEndPoint(0), geom_curve.GetEndPoint(1))) call_params = 'Name:{} Model:{} FilledRegion:{} Domain:{}\n' \ 'Lines:{}\n'\ 'FillGrids:{}'\ .format(self.pat_name, self.is_model_pat, self.create_filledregion, domain, line_tuples, self.selected_fillgrids) logger.debug(call_params) if export_only: patmaker.export_pattern( export_path, self.pat_name, line_tuples, domain, fillgrids=self.selected_fillgrids, scale=self.pat_scale * self.export_scale, model_pattern=self.is_model_pat, allow_expansion=self.highestres_cb.IsChecked) forms.alert('Pattern {} exported.'.format(self.pat_name)) else: patmaker.make_pattern(self.pat_name, line_tuples, domain, fillgrids=self.selected_fillgrids, scale=self.pat_scale, rotation=math.radians(self.pat_rotation), flip_u=self.flip_horiz, flip_v=self.flip_vert, model_pattern=self.is_model_pat, allow_expansion=self.highestres_cb.IsChecked, create_filledregion=self.create_filledregion) forms.alert('Pattern {} created/updated.'.format(self.pat_name))