@keshishian1 hi,
First, point style is controlled by PDSIZE sysvar, you also have to set it in order to see point style. so you set PDMODE at start, do some work (DIVIDE), reset it back at exit. that would be normal coding but not for points style 😀. PDMODE + PDSIZE are fully dynamic much like dimensions style. when you set them, AutoCAD applies the change on all existing points so
restoring PDMODE back will leave you with nothing (see noting).
lets look at the next line...
(command "._DIVIDE" obj (itoa segments))
(command) function can accept number of data type of arguments . string is one of them (what you did is ok) but where is possible it also can have numbers (int or real) even list for points so in this case there is no need to convert the int to string.
So your code basically good but i would like to show you another solid method.
in cases you need multiple tesing in a row, use (cond) function to test on negative path, that is, if user fail to select object for divide issue error message. if user fail to provide the number for divide issue error message.
and one last thing 😀
good practice is to wrap the command with
(command "._undo" "_begin")
.......
.......
.......
(command "._undo" "_end")
this enables you to undo the command with one U (as any other AutoCAD standard commands)
see my example code.
enjoy
Moshe
(defun c:DV (/ sel segments obj)
(setvar "cmdecho" 0) ; disable command echo
(command "._undo" "_begin") ; start undo mark
(setvar "pdmode" 2) ; point style
(setvar "pdsize" -2) ; point size
(princ "\nPoint style set to Cross.")
(cond
((not (setq sel (entsel "\nSelect object for divide: ")))
(prompt "\nNo object selected.")
); case
((not (setq segments (getint "\nDivide to number of segments: ")))
(prompt "\nRequire number segments.")
); case
(t
(setq obj (car sel))
(command "._divide" obj segments)
); case
); cond
(command "._undo" "_end") ; end undo mark
(setvar "cmdecho" 1) ; restore command echo
(princ)
); c:DV
@