survey01 Posted November 21, 2024 Posted November 21, 2024 Hi everyone, I'm trying to make a small program to export objects by their layer group filter name. (see attached lisp) The code so far works; however, it is a bit slow. Is there a more efficient way to copy layers into a new dwg other than vla-CopyObjects?. I essential create a list of layer names that belong to a group filter and iterate over every object and check if it belongs to that layer and copy it to the new dwg if it does. There are also a couple of small errors I can't figure out: 1. table objects wont copy (not too much of a concern but i would like to know why?) 2. I sometimes run into this error in some drawings: error: Automation Error. Object was erased (I use this in Civil 3D might have something to do with it) Any help would be greatly appreciated. Thanks! Layer Export Test.lsp Quote
BIGAL Posted November 22, 2024 Posted November 22, 2024 (edited) If you have only the layer filter layers on then use Wblock does this do what you want ? No code required. Option 2 same use layer filter Ctrl+c select all items, go to other dwg, use "Paste to original co-ordinates" used it most days Edited November 22, 2024 by BIGAL Quote
survey01 Posted November 24, 2024 Author Posted November 24, 2024 Hi Bigal, Thanks for the response. We are engineering surveyors and use civil 3D to digitize and export setout data to guys in the field. In the past we used the copy and paste approach by stating a blank template drawing but in civil 3D this is a bit tedious and the native export to dxf functions will export all the information in the drawing which is too messy for survey data to be used effectively. We made this autolisp to speed up this process with preset buttons for different groups and it works really well, apart from the occasional error here and there. This approach works best for us as we only keep the setout data in the group filters for their respective category e.g. sewer, electrical etc. with this code we can export what we need in just one click. Wblock might work if there is a way to run the command using code and feed in the list of layers to create the block. I don't have much experience with this command so not too sure. I was trying to see if there was more efficient coding approach then the one I'm currently using. ideally something that could check if a layer is active with with objects in it and if it is copy that layer into the new dwg. Thanks, Quote
BIGAL Posted November 24, 2024 Posted November 24, 2024 "feed in the list of layers" if you using layer filters then set the correct layer filter, this should result in only those layers now showing, then you can use wblock as this will export out the current display to a new dwg, yes wblock command can be part of a lisp. Just try Wblock follow the prompts it should be clear then. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.