![]() Of course, this practice can quickly come to involve sometimes complex and tricky coding. In more sophisticated cases, applications interrogate the geometry when they restart. But the application that runs over and over again or has multiple restart points needs to know what happens to the drawing in between restarts. At this point, the program has no way of knowing what the user does to the drawing. Or refer to the listings at the bottom of this page.Īpplication programs tend to be simple-minded once the program returns control to the AutoCAD user. Or, you can follow the Visual LISP ActiveX route and use the AddLine method of the relevant Block container, e.g.Reactors-Making Aware Programs 31 Aug, 1999 By: Bill Kramer Get this code!. Instead, you can use the entmake or entmakex function to append the DXF data to the drawing database directly: (setq p '(0.0 0.0 0.0) Of course, the most bulletproof way of avoiding the influence of Object Snap on command point input is to avoid commands entirely! Now, if the code encounters an error whilst Object Snap is turned off, the Object Snap settings are not lost - the user may simply need to turn Object Snap back on using F3. (setvar 'osmode (logior 16384 m)) Turn off Object Snap This can be implemented as follows: (setq p '(0.0 0.0 0.0) Therefore, if 16384 is already present in the value, it will be returned, else it will be added. This will return the result of a bitwise inclusive OR operation between bit 16384 and the current value of the OSMODE system variable. Now, rather than using an if statement to test whether bit 16384 is present in the OSMODE value, and if so, subtract it from the value, we can make use of the AutoLISP logior (inclusive bitwise OR) function to account for both scenarios in a single expression: (setvar 'osmode (logior 16384 (getvar 'osmode))) Therefore, a more 'graceful' way to temporarily disable OSMODE is to make use of bit 16384 which, when set, indicates that Object Snap has been turned off. However, this method has the disadvantage that if an error occurs during the time in which OSMODE is set to 0, in the absence of an appropriate error handler, OSMODE will remain equal to 0 and the user will be apoplectic when they discover they have lost their Object Snap settings. (setvar 'osmode m) Reset OSMODE to stored value (setvar 'osmode 0) Set OSMODE to 0 (disables all snaps) The obvious way to achieve this would be to store the current value of the OSMODE system variable, set such system variable to 0 before issuing your command expression, and then reset the OSMODE system variable to its previous value, e.g.: (setq p '(0.0 0.0 0.0) Whilst the above method acknowledges that there may be active Object Snap modes, forcing such modes to be ignored for every point input, if you are issuing many command calls involving numerous point inputs, you may find it cleaner to simply temporarily disable Object Snap altogether, and then reenable the previously active modes following completion of your program. (as used in "_.line") causes AutoCAD to always use the original definition of the command, and not a redefined version (as may exist if the user has used the UNDEFINE command). ![]() ![]() English), else, if such input were supplied to a non-English version of AutoCAD, it may carry another meaning in the non-English language. The underscore prefixes _ (as used in "_.line" and "_non") cause AutoCAD to interpret the input as non-localised command input (i.e. Here is an example of this method: (setq p '(0.0 0.0 0.0) ![]() The full list of available prefixes may be found here. This is similar to how you might precede a point with end to force the activation of the Endpoint Object Snap modifier, but in this case, none or non means "ignore all Object Snap modes". When supplying points to an AutoCAD command through an AutoLISP command expression, you can avoid the effect of any active Object Snap modes by preceding the point with the none or non Object Snap modifier. Firstly, I suspect that the issue with your current attempts is the influence of active Object Snap modes when supplying points to the LINE command. ![]()
0 Comments
Leave a Reply. |