This was my test code and yes once I added osmode 0 it started to work. Just make the couple of changes to your code. Maybe experiment with the adding NON to your move with regards to the two points.
(defun c:wow ( / oldsnap e1 e2 obj1 obj2) cen1 cen2)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq e1 (car (entsel "\nPick viewport 1 ")))
(setq obj1 (vlax-ename->vla-object e1))
(setq cen1 (vlax-get obj1 'Center))
(setq e2 (car (entsel "\nPick viewport 2 ")))
(setq obj2 (vlax-ename->vla-object e2))
(setq cen2 (vlax-get obj2 'Center))
(command "move" e1 "" cen1 cen2)
(setvar 'osmode oldsnap)
(princ)
)
(c:wow)
@leonucadomi beat me by 1 minute.
@BIGAL
Okay, I wrote something.
It seems to work. It needs some cleanup no doubt
It's a way to extract numbers from a string.
@Nikon is your problem solved?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; @FILE:
;; function ENFS (for Extract Numbers From String) takes a string and returns a list of numbers in the string
;; the list is (list (list startPosition stringLength string) ... ) for each found number
;; substring, like php substr
(defun substring ( str idx len )
(substr str (if (< idx 0) (+ 1 (strlen str) idx) (1+ idx)) len)
)
;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vba-method-quot-isnumeric-quot-lt-useing-in-vlisp/m-p/793105#M18763
(defun IsNumeric (string)
(and
(lastCharNumeric string)
(distof string 2)
)
)
;; requires function substring
(defun lastCharNumeric (str / chrs)
(setq chrs (vl-string->list str))
(and
(> (last chrs) 44) (< (last chrs) 58)
)
)
(defun c:ENFS ( / str)
(setq str (getstring "\nString: " T))
(princ
(ENFS str)
)
(princ)
)
;; ENFS for Extract Numbers From String
(defun ENFS (str / i concat_num start numbers_data tent_num x )
(setq concat_num nil)
(setq start 0)
(setq numbers_data (list))
(setq sure_num "") ;; last sure numeric string
(setq tent_num "") ;; tentative number. A string that
(setq i 0)
(foreach x (setq chrs (vl-string->list str))
(if (or
(and (> x 44) (< x 58)) ;; 0 to 9
(= x 43) (= x 45) (= x 46) (= x 101) (= x 69) ;; + - . e E ;; characters that can possibly be part of a number. For example 12.54e+6
)
(progn ;; numerical
(if concat_num nil
(progn
(setq start i)
(setq concat_num T)
)
)
(setq tent_num (substring str start (+ 1 (- i start)) ) )
(if (IsNumeric tent_num)
(progn
(setq sure_num tent_num)
;;(princ tent_num)
)
)
;;(princ (chr x))
)
;; else: not possibly a character that forms a number.
;; so if this was not already done, we stop the number concatenation
(progn
(setq concat_num nil)
;;(princ "\n*")
)
)
;; if it's the last character, we stop concatenating, so the last number gets added if it's at the end of the string
(if (= i (- (strlen str) 1) )
(setq concat_num nil)
)
;; see if we must add the number to the list
;; if tent_num
(if (> (strlen sure_num) 0)
(if concat_num
T
;; concatenating the number has ended, we will add the number to the list
(progn
(setq numbers_data (append numbers_data (list
(list i (strlen sure_num) sure_num)
)))
(setq sure_num "")
)
)
)
(setq i (+ i 1))
)
;;(princ "\n\n")
;;(princ numbers_data)
;; return list
numbers_data
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
No, in AutoCAD it shows for (sslength MySS) = 0 and in BricsCAD it shows number greater than 0 (in my case 2) as I had rectangle and text in block that was normaly created (it's not dynamic as I explained)...
Maybe it does also work in AutoCad Marko , I'm just not sure , I have no test material , certainly not 95Mb , are you sure its an AutoCad drawing and not a dirty movie?
Maybe another usefull link (haven't tried it yet) :
I don't think the person with the problem should get any credit.....
Big, Gigantic, Massive kudo's to Steven P here.....
(and also to Lee, ronjonp, BigAl, mhupp, Tharwat, hanhphuc, SLW210, rlx, and SO MANY MORE who have helped me in the past!!!!!!)