David Bethel Posted October 5, 2016 Posted October 5, 2016 Why does this code crash in 2012 ? It's just a simple insert command that has never been a problem (command "_.LAYER" "_ON" "0" "_Thaw" "0" "_Unlock" "0" "_Set" "0" "") (command "_.VPOINT" '(0 0 1) "_.UCS" "_W" "_.PLAN" "_W") (command "_.INSERT" (strcat m f) '(0 0 0) 1 1 0) Text history : Command: _.UCS Current ucs name: *WORLD* Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] <World>: _W Command: _.PLAN Enter an option [Current ucs/Ucs/World] <Current>: _W Regenerating model. Command: _.INSERT Enter block name or [?]: c:/0-fx2/r14/ABA011 Substituting [simplex.shx] for [txt]. Substituting [simplex.shx] for [txt]. [color="red"]Units: Millimeters Conversion: 0.03937008[/color] Specify insertion point or [basepoint/Scale/X/Y/Z/Rotate]: Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>: 1 Enter Y scale factor <use X scale factor>: 1 Specify rotation angle <0>: 0 I've never run into this before. and it's driving me nuts -David Quote
Stefan BMR Posted October 5, 2016 Posted October 5, 2016 Try the entmake route. Note that the block looks like 1:1, but the Scale and the Scale Factor are affected by your settings. (entmakex (list '(0 . "INSERT") (cons 2 (strcat m f)) '(10 0.0 0.0 0.0) '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) '(50 . 0.0) ) ) Quote
David Bethel Posted October 5, 2016 Author Posted October 5, 2016 So far so good (command "_.INSERT" (strcat m f)) (command) (entmake (list (cons 0 "INSERT")(cons 2 f)(list 10 0 0 0))) A lot a unnecessary work. But it is working Thanks! -David Quote
David Bethel Posted October 5, 2016 Author Posted October 5, 2016 1 of the crazy parts of this is that I had converted all 400 files I'm having to deal with back Release 14 so I wouldn't have to mess with this type of junk. Apparently some of the 400 files had been created using a metric template, the balance imperial. -David Quote
David Bethel Posted October 5, 2016 Author Posted October 5, 2016 In case anyone else runs into this problem https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Blocks-xrefs-or-raster-images-are-scaled-when-inserted.html Quote
Lee Mac Posted October 5, 2016 Posted October 5, 2016 Have you tried setting INSUNITS=0 and INSUNITSDEFTARGET=0? ( EDIT: Too slow - I see you have posted a link explaining this ) Quote
David Bethel Posted October 5, 2016 Author Posted October 5, 2016 Finally found some info. I take it doesn't matter how the file was created, it is the settings in the file that is being inserted into. I also take it these sysvars are turned on (1) by default if a template file is not used to start a new drawing. Which I do quite a lot Thanks! -David Quote
Stefan BMR Posted October 5, 2016 Posted October 5, 2016 Finally found some info. I take it doesn't matter how the file was created, it is the settings in the file that is being inserted into. I also take it these sysvars are turned on (1) by default if a template file is not used to start a new drawing. Which I do quite a lot Thanks! -David Sorry David, I took literally "bypass the UNITS" when I've made my suggestion, assuming you know about these sysvars. Quote
David Bethel Posted October 5, 2016 Author Posted October 5, 2016 Sorry David, I took literally "bypass the UNITS" when I've made my suggestion, assuming you know about these sysvars. That's OK. I don't use these newer releases unless I absolutely have to in developing routines for clients. But yours did work as advertised ! I blame AutoDesk for breaking backward compatibilty in the command sequence. Shame on them ! ie The EXPLODE command in AutoLISP still expects a single ename in AutoLISP -David Quote
marko_ribar Posted October 5, 2016 Posted October 5, 2016 The EXPLODE command in AutoLISP still expects a single ename in AutoLISP -David QAFLAGS = 1... But not my advice to use it in code, only if you have to, and make sure you reset it back to 0... To be sure and what is my advice : put (setvar 'QAFLAGS 0) in acaddoc.lsp, so you may never experience issues like not working ACET- functions and turning LAYER dialog box with calling (command "_.-LAYER" ... ) from AutoLisp, and ... (who knows what else is wrong when QAFLAGS=1 and you are lisping...) Quote
David Bethel Posted October 6, 2016 Author Posted October 6, 2016 QAFLAGS I agree, only if absolutely needed. -David 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.