ed2ee2f6f3
When extruding supports, the support is interleaved with interface if possible (when extruded with the same extruder). Otherwise the base is extruded first.
105 lines
4.0 KiB
Plaintext
105 lines
4.0 KiB
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <xsinit.h>
|
|
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
|
%}
|
|
|
|
%name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection {
|
|
%name{_new} ExtrusionEntityCollection();
|
|
~ExtrusionEntityCollection();
|
|
Clone<ExtrusionEntityCollection> clone()
|
|
%code{% RETVAL = THIS->clone(); %};
|
|
void reverse();
|
|
void clear();
|
|
ExtrusionEntityCollection* chained_path(bool no_reverse, ExtrusionRole role = erMixed)
|
|
%code{%
|
|
RETVAL = new ExtrusionEntityCollection();
|
|
THIS->chained_path(RETVAL, no_reverse, role);
|
|
%};
|
|
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse, ExtrusionRole role = erMixed)
|
|
%code{%
|
|
RETVAL = new ExtrusionEntityCollection();
|
|
THIS->chained_path_from(*start_near, RETVAL, no_reverse, role);
|
|
%};
|
|
Clone<Point> first_point();
|
|
Clone<Point> last_point();
|
|
int count()
|
|
%code{% RETVAL = THIS->entities.size(); %};
|
|
int items_count()
|
|
%code{% RETVAL = THIS->items_count(); %};
|
|
ExtrusionEntityCollection* flatten()
|
|
%code{%
|
|
RETVAL = new ExtrusionEntityCollection();
|
|
THIS->flatten(RETVAL);
|
|
%};
|
|
double min_mm3_per_mm();
|
|
bool empty()
|
|
%code{% RETVAL = THIS->entities.empty(); %};
|
|
std::vector<size_t> orig_indices()
|
|
%code{% RETVAL = THIS->orig_indices; %};
|
|
Polygons polygons_covered_by_width();
|
|
Polygons polygons_covered_by_spacing();
|
|
%{
|
|
|
|
SV*
|
|
ExtrusionEntityCollection::arrayref()
|
|
CODE:
|
|
AV* av = newAV();
|
|
av_fill(av, THIS->entities.size()-1);
|
|
int i = 0;
|
|
for (ExtrusionEntitiesPtr::iterator it = THIS->entities.begin(); it != THIS->entities.end(); ++it) {
|
|
SV* sv = newSV(0);
|
|
// return our item by reference
|
|
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(*it)) {
|
|
sv_setref_pv( sv, perl_class_name_ref(path), path );
|
|
} else if (ExtrusionMultiPath* multipath = dynamic_cast<ExtrusionMultiPath*>(*it)) {
|
|
sv_setref_pv( sv, perl_class_name_ref(multipath), multipath );
|
|
} else if (ExtrusionLoop* loop = dynamic_cast<ExtrusionLoop*>(*it)) {
|
|
sv_setref_pv( sv, perl_class_name_ref(loop), loop );
|
|
} else if (ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(*it)) {
|
|
sv_setref_pv( sv, perl_class_name_ref(collection), collection );
|
|
} else {
|
|
croak("Unexpected type in ExtrusionEntityCollection");
|
|
}
|
|
av_store(av, i++, sv);
|
|
}
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
void
|
|
ExtrusionEntityCollection::append(...)
|
|
CODE:
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
if(!sv_isobject( ST(i) ) || (SvTYPE(SvRV( ST(i) )) != SVt_PVMG)) {
|
|
croak("Argument %d is not object", i);
|
|
}
|
|
ExtrusionEntity* entity = (ExtrusionEntity *)SvIV((SV*)SvRV( ST(i) ));
|
|
// append COPIES
|
|
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(entity)) {
|
|
THIS->entities.push_back( new ExtrusionPath(*path) );
|
|
} else if (ExtrusionMultiPath* multipath = dynamic_cast<ExtrusionMultiPath*>(entity)) {
|
|
THIS->entities.push_back( new ExtrusionMultiPath(*multipath) );
|
|
} else if (ExtrusionLoop* loop = dynamic_cast<ExtrusionLoop*>(entity)) {
|
|
THIS->entities.push_back( new ExtrusionLoop(*loop) );
|
|
} else if(ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(entity)) {
|
|
THIS->entities.push_back( collection->clone() );
|
|
} else {
|
|
croak("Argument %d is of unknown type", i);
|
|
}
|
|
}
|
|
|
|
bool
|
|
ExtrusionEntityCollection::no_sort(...)
|
|
CODE:
|
|
if (items > 1) {
|
|
THIS->no_sort = SvTRUE(ST(1));
|
|
}
|
|
RETVAL = THIS->no_sort;
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
%}
|
|
};
|