forked from 1b-agent/opencadstudio-upstream
Complete associative centerline workflow
This commit is contained in:
1 parent
573ed3245e
commit
eba4fb87a8
14 files changed
+683
-223
No files matched your search
+10
-1
@@ -265,12 +265,21 @@ pub fn extract_pattern(desc: &str) -> String {
|
||||
|
||||
/// Add all standard OpenCADStudio linetypes to `doc`, skipping existing ones.
|
||||
pub fn populate_document(doc: &mut CadDocument) {
|
||||
for mut lt in parse(LIN_SOURCE) {
|
||||
populate_document_from_source(doc, LIN_SOURCE);
|
||||
}
|
||||
|
||||
/// Add all simple linetypes parsed from a caller-supplied `.lin` source.
|
||||
/// Returns the number of definitions newly registered in the drawing.
|
||||
pub fn populate_document_from_source(doc: &mut CadDocument, source: &str) -> usize {
|
||||
let mut added = 0;
|
||||
for mut lt in parse(source) {
|
||||
if !doc.line_types.contains(<.name) {
|
||||
lt.set_handle(doc.allocate_handle());
|
||||
doc.line_types.add(lt).ok();
|
||||
added += 1;
|
||||
}
|
||||
}
|
||||
added
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user