-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't create block successfully #23
Comments
AutoCAD is extremely pick about what it will accept, and frankly I haven't figured out the exact formula yet. That said, other CAD apps are less strict and LibreCAD will open the following DXF with a block: let mut drawing = Drawing::new();
// this creates a block with a single line from (0,0) to (1,1)
// n.b., the block will not yet be displayed on screen; it exists simply as a "template" that can be inserted later
let mut block = Block::default();
block.name = String::from("block_name");
block.entities.push(Entity::new(EntityType::Line(Line::new(
Point::new(0.0, 0.0, 0.0),
Point::new(1.0, 1.0, 0.0),
))));
drawing.add_block(block);
// this inserts a copy of the "block_name" block at location (2,2)
// the result of this is a line from (2,2) to (3,3)
let mut ins = Insert::default();
ins.name = String::from("block_name");
ins.location = Point::new(2.0, 2.0, 0.0);
let ins = Entity::new(EntityType::Insert(ins));
drawing.add_entity(ins);
// this inserts a copy of the "block_name" block at location (2,-2)
// the result of this is a line from (2,-2) to (3,-1)
let mut ins = Insert::default();
ins.name = String::from("block_name");
ins.location = Point::new(2.0, -2.0, 0.0);
let ins = Entity::new(EntityType::Insert(ins));
drawing.add_entity(ins);
drawing.save_file("test.dxf").ok(); |
@Dynabits Thank you for that link, I hadn't seen that before and it was very helpful. I've pushed commit 944f6e4 to That commit also contains the file I'll start testing R13+ and see what I can come up with. |
Every Time ACAD 2018 crashes with the generated file from this code:
I think I'm not creating the block correctly, the goal is to have the point and the attribute entities inside the block.
Any help would be very appreciated.
PS: I'm new to rust and dxf spec.
The text was updated successfully, but these errors were encountered: