- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
Drewpan wrote >>and KC replies :
....
(command "LEADER" PNT1 PTXT "" COORDE COORDN "")....
I want it to display (X 4.5, Y 2.2) instead
>> Further use for the (strcat) function:
(strcat "(X " COORDE ", Y " COORDN ")")
... make it display only what it has to and kill any trailing zeros
eg. the point X = 4, Y = 2.2 would be displayed (4, 2.2) instead of something like (4.000, 2.200)
>>Read about the DIMZIN System Variable, which affects trailing zeros in (rtos), among other things.
... to modify this script to work in 3D ....
(setq P1Z (cadr pnt1)) ;z coord <<-- what variable returns the actual z coordinate here?
>> Another d: (setq P1Z (caddr pnt1))
leading to:
(strcat "(X " COORDE ", Y " COORDN ", Z " COORDQ ")" )
... will the 3D version of the script kick an error if I am using 2D? or in other words must I have two separate scripts for this in 2D and 3D or will the one script just
ignore the missing z coordinate in a 2D environment?
>>There's no such thing as a 2D environment -- AutoCAD works in 3D, and if you're not involving the Z direction, that's up to you. The return of points from (getpoint) always includes a Z coordinate. And most point information about objects [Circle centers, Line endpoints, etc.] also has a Z coordinate.
However, there is a complication with a LWPolyline. It must be "flat," and its entity data includes an elevation in the Z direction, which applies to all of it, and then it stores all the vertex locations with XY coordinates only. So if you're pulling point locations from entity data about a LWPolyline, and you need the Z coordinate, you must get the XY from the vertex information, and the Z from the global elevation. Write back if you need to know how to do that.
If by "a 2D environment" you mean just working in the World Coordinate System's XY plane only, a single routine could be made to display only the X and Y coordinates if the Z coordinate is 0, but display all three if it's not.
.... can you please give me step by step instructions on how to automatically load this script when I fire up AutoCAD. ....
>> [It's not a "script" -- that word has a specific, and different, meaning in AutoCAD.] Read about the acaddoc.lsp file. Put your code into that, and put that in a location in the Support File Search Path list in OPTIONS, and it will be loaded in every drawing. [There are other possibilities, but that's the "standard" approach.]