bc Posted May 6, 2021 Share Posted May 6, 2021 Perhaps my issue can be dealt with via Marionette but that is way beyond my ken. So I will ask, when importing a DWG file, is there a way to import only lines/polys? As it is now, the import seems to convert blocks to symbols. So I have a hundreds of symbols with gigantic lineweights. See below: Each door or window, for example, is a symbol so I have to go in and edit the 2D linework to create something legible. So I ask, is there a way to import this withy say nothing but .05 lines/polys? thanks bc Quote Link to comment
zoomer Posted May 6, 2021 Share Posted May 6, 2021 Had that too. Took a lot of time until I solved it. Unfortunately I forgot how. (Applying a custom line style or such ....) Quote Link to comment
bc Posted May 6, 2021 Author Share Posted May 6, 2021 Thanks, I think. It's good to at least know I am not alone. If I only I was a puppeteer...... Quote Link to comment
jbtroost Posted May 6, 2021 Share Posted May 6, 2021 (edited) When importing you can assign line weights to classes, etc. All symbols will then remain, speeding up the file when loading/moving/editing. Edited May 6, 2021 by Jan-Burger TROOST Quote Link to comment
Jeff Prince Posted May 6, 2021 Share Posted May 6, 2021 (edited) @bc That looks a lot like the old AutoCAD trick of using Pline thickness to get thick lineweights. When I moved from AutoCAD to Vectorworks, there was a log of that in my legacy files and symbols. I suspect if you look in one of those symbols, you will find that the vectorworks lineweight for the particular object is set to something big. To resolve... Use the magic wand (with the appropriate settings) to select the symbols convert them to groups (cmd K) ungroup them (cmd U) and then set their lineweight to byclass in the attribute panel. That would be the manual method of fixing it and akin to your desire to import blocks as just plain geometry. I have to do this each time I import most of the work from outside architects and civil engineers. Alternatively, you could ask them to set their pline thickness to 0 or those objects if they are keen to making your life a little easier 🙂 There is really no good reason in AutoCAD to use the pline trick since the adoption of line weights like 20 years ago. edit: Having autocad blocks imported as symbols might be a good thing for you if those symbols are repeated many times through the project. All you have to do is go into a symbol, fix the graphics, and all the instances will update accordingly. That might help with your doors and windows if you want to keep them as symbols instead of raw geometry. If each symbol is unique and not repeated in the file, I would opt for my method described earlier. Edited May 6, 2021 by jeff prince Quote Link to comment
michaelk Posted May 6, 2021 Share Posted May 6, 2021 This happens to me on half of the DWGs I import. A couple years ago I got annoyed enough to make a little hacky script to stomp out crazy line weights. It's not an example of good scripting but I use it almost every time I import a DWG 🙂 . It works on lines inside of symbols. You can change the threshold from 10 mils to whatever you need. I haven't bothered to look up if it matters what the document line weight units are. PROCEDURE Test; VAR LW : INTEGER; PROCEDURE StompIt(h:HANDLE); BEGIN LW := GetLW(h); IF LW >10 THEN SetLW(h,10); END; BEGIN ForEachObject(StompIt,(INSYMBOL & ((LW<>2)))); END; RUN(Test); 4 Quote Link to comment
Jeff Prince Posted May 6, 2021 Share Posted May 6, 2021 @michaelk how do you save and run scripts like this? Quote Link to comment
michaelk Posted May 6, 2021 Share Posted May 6, 2021 Scripts are resources in the resource manager. The main difference between scripts and other resources is that scripts MUST be in folders (called palettes) Copy the text from the post above. In your Resource Manager > New Resource… > Script > Name the palette > Name the script > In the Script Editor window paste the above script. Make sure the language is set to Vector Script. Once it's in your Resource Manager you can right click on the folder and choose open or go to Window > Script Palettes to open the palette. Once it's open double clicking the script in the palette will make it run. Or you can right click on the script in the resource manager and choose run. 3 Quote Link to comment
Jeff Prince Posted May 6, 2021 Share Posted May 6, 2021 @michaelk thanks for the explanation! Quote Link to comment
bc Posted May 6, 2021 Author Share Posted May 6, 2021 Hey, thanks everyone! I'll try that script, thanks michaelk. I'll also look into the class assignment possibility mentioned by mr. troost. @jeff prince the problem is that every object is a separate symbol. a 30" door here is different symbol than a 30" door over there. 1 Quote Link to comment
bc Posted May 6, 2021 Author Share Posted May 6, 2021 OK so I ran the script and after a bit the screen redraws and nothing seems to have changed. When I double click and edit the 2D of the symbol, I see that the linework is indeed changed and without doing anything more, I exit the symbol and the linewt changes. So I will still have to enter each symbol individually. Quote Link to comment
michaelk Posted May 6, 2021 Share Posted May 6, 2021 So you're finding that the symbols need to redraw after running the script? Quote Link to comment
bc Posted May 6, 2021 Author Share Posted May 6, 2021 I run the script. Less than 10 seconds passes and all of the objects blink off then on again with no visual change. When I enter the symbol I see that it actually has changed so I exit. Voila. But I still have to enter/exit the symbol. Quote Link to comment
Jeff Prince Posted May 6, 2021 Share Posted May 6, 2021 (edited) @bc if you close and reopen you file, the symbols and such redraw fine, without having to enter the symbols. Edited May 6, 2021 by jeff prince Quote Link to comment
bc Posted May 6, 2021 Author Share Posted May 6, 2021 2 hours ago, Jan-Burger TROOST said: When importing you can assign line weights to classes, etc. All symbols will then remain, speeding up the file when loading/moving/editing. Well, I couldn't find that capability in "Advanced" or anywhere during importing. But AFTER importing I selected all the classes and edited them simultaneously to the weight I wanted. That worked. Thanks for that lead Jan-Burger TROOST! Quote Link to comment
michaelk Posted May 6, 2021 Share Posted May 6, 2021 Ha. I just read this script. Really clunky. If I get a second and @PatStanford doesn't beat me to it I'll make the ForEachObject criteria be not so bad and add a reset for symbols. It's another example of a script where the first time it did what I needed was the last time I looked at it. I've been using it for years not realizing how clunky it is 🙂 Quote Link to comment
Jesse Cogswell Posted May 7, 2021 Share Posted May 7, 2021 (edited) Here's the fix that should cover the redraw: PROCEDURE Test; PROCEDURE StompIt(h:HANDLE); VAR LW : INTEGER; BEGIN LW := GetLW(h); IF LW >10 THEN SetLW(h,10); ResetObject(h); END; BEGIN ForEachObject(StompIt,(INSYMBOL & ((LW<>2)))); ReDrawAll; END; RUN(Test); It's not all that clunky, really. I moved the LW variable in to the StompIt procedure since you don't need it to be global, and I added some indentation to make it a hair more legible. But the core script is about as elegant as it can be for what it does. The only change that I would consider making would be to add in a criteria for the ForEachObject procedure to only operate on the active layer (since DWG exports tend to be on a single layer immediately following import) to remove the possibility of accidentally overwriting intentionally set high line weights (I usually have a higher line weight on my title blocks, for example), or to just set all of the flagged objects to setting the line weight to be By Class, as I think that would be more useful in the long run. This comes with the added benefit of not needing an additional callback procedure for the ForEachObject procedure. These changes are made below: PROCEDURE Test; VAR activeLayer:STRING; BEGIN activeLayer:=GetLName(ActLayer); ForEachObject(SetLWByClass,(INSYMBOL & (L=activeLayer))); ReDrawAll; END; RUN(Test); Edited May 7, 2021 by Jesse Cogswell Removed not needed LW<>2 criteria from script. Quote Link to comment
michaelk Posted May 7, 2021 Share Posted May 7, 2021 Thanks @Jesse Cogswell ! I was going to take LW out of the criteria, since it makes absolutely no sense being there. And then do another procedure to find all the reset all the symbols. Might do it tonight depending on how the evening goes 🙂 Quote Link to comment
Jesse Cogswell Posted May 7, 2021 Share Posted May 7, 2021 @michaelk Oops, forgot to remove that criteria in the second script, since it's really not necessary. The ReDrawAll should cover doing the reset, at least it did in my (admittedly very quick) testing. Quote Link to comment
michaelk Posted May 7, 2021 Share Posted May 7, 2021 I just tried removing the LW test. In my original script -- that I've been using for years -- it let me declare a variable called LW and use the LW meaning Line Weight as part of a conditional in the criteria. Bone headed on my part. Can't believe that it worked at all 🙂 But using line weight in the criteria does an interesting thing. It only returns objects that can have a line weight. If you just look at objects on the layer or objects that aren't loci then it passes inappropriate objects, like symbols, to the procedure. Better to be lucky than good. Here's a new version: PROCEDURE Test; CONST kLWThreshold = 10; VAR HLyr : HANDLE; LyrNm : STRING; PROCEDURE StompIt(h:HANDLE); BEGIN IF GetLW(h) > kLWThreshold THEN SetLW(h,kLWThreshold); END; BEGIN HLyr := ActLayer; LyrNm := GetLName(HLyr); ForEachObject(StompIt,((INSYMBOL & (L=LyrNm) & (LW<>2)))); ReDrawAll; END; RUN(Test); Looks like SetLW always uses Mils, no matter what the document line weight unit is. This version will only look at the active layer. In my quick testing it handles objects in symbols and in nested symbols! Quote Link to comment
michaelk Posted May 7, 2021 Share Posted May 7, 2021 If you want to play with fire, this little script will convert all the symbols in the drawing to groups. Be real careful 🙂 PROCEDURE Test; VAR OK : BOOLEAN; PROCEDURE ExplodeIt(h:HANDLE); BEGIN SymbolToGroup(h,2); END; BEGIN OK := YNDialog('Are you really sure you want to do this? All symbols will be converted to groups. Think about it.'); IF OK THEN ForEachObject(ExplodeIt,((INSYMBOL & (T=SYMBOL)))); END; RUN(Test); Quote Link to comment
bc Posted May 7, 2021 Author Share Posted May 7, 2021 (edited) This last one might be the best for me because I only want the 2D and don't want any symbols OR CLASSES ! Why can't VW just bring the blocks in as groups in the first place? Thanks for all of this everyone. Edited May 8, 2021 by bc Quote Link to comment
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.