Upgrading from AutoCAD 2015 or earlier to AutoCAD 2016 or AutoCAD 2017?
If you are in the process of upgrading to a recent release of an AutoCAD-based product, you will want to check the scripts, action macros, and custom programs that you use for any usage of the -OSNAP
command, OSMODE
system variable, or AutoLISP OSNAP
function. Starting with AutoCAD 2016, the Quick object snap or 'qui' mode is no longer supported and result in unexpected behavior if used.
-OSNAP Command
When the Quick object snap is used with the -OSNAP
command in AutoCAD 2016 and later, the Invalid object snap modes.
error message is displayed along with the command re-prompting for a valid list of object snaps again. The prompt being displayed again could cause potential problems with future commands, keywords, and values in the script or custom program.
Command: -OSNAP
Current osnap modes: End,Cen,Int,Ext
Enter list of object snap modes: QUI,END
Invalid object snap modes.
Enter list of object snap modes:
Solution: Remove QUI from the list of object snaps passed to the -OSNAP
command, and then retest the affected scripts and custom programs.
OSMODE System Variable
Starting with AutoCAD 2016, the bitcode value of 1024 no longer represents the Quick object snap but rather the Geometric Center object snap. Since the 1024 bitcode value was repurposed, any script or custom program that expects the Quick object snap might produce unexpected results.
Solution: If your program doesn't require the Geometric Center object snap, you might want to remove the 1024 bitcode value from the sum that is being assigned to the OSMODE
system variable as part of the script or custom program. Once the value has been changed or a decision is to leave it unchanged is made, be sure to test the script or custom program to ensure it is working as expected.
AutoLISP OSNAP Function
The AutoLISP OSNAP
function returns a list representing a 3D point or a nil
value based on the provided point and comma-delimited string that represents the object snap modes to use. The 3D point returned is calculated based on the objects near the point provided and within the area of the aperture box along with the object snap modes listed, nil
is returned if no point could be calculated based on the lack of objects within the aperture box or none of the object snap modes listed being valid for the objects in the aperture box. If the '_qui'
object snap mode is specified in a program that is executed by AutoCAD 2016 or later, the point returned will always be nil
since the object snap no longer exists.
Solution: Remove qui or _qui from the comma-delimited string that represents the list of object snap modes to be passed to the OSNAP
function. After the object snap mode has been removed, retest the affected custom program.
Hope you found the information in this article useful.
Sincerely,
Lee
Recent Comments