Jump to content

error: ActiveX Server returned the error: unknown name: EASTING


Recommended Posts

Posted

Sounds like your calling an undeclared variable. or you need to set the units.

 

image.png.9857e24a675b034a189fd929dcd07cab.png

Posted
2 hours ago, Vjeksi said:

Can anybody help me?

You should provide your code. Guessing you're not filtering the correct objects and asking for a property that is not available.

(if (vlax-property-available-p object 'easting)
  (vlax-get object 'easting)
)

 

Posted
8 hours ago, Vjeksi said:

Can anybody help me?

Attach an example code and a drawing

Posted (edited)
On 2/17/2022 at 6:11 PM, hosneyalaa said:

Attach an example code and a drawing

Code is correct, because it works on another PC....I think the problem is in the ACAD settings

 

CODE:

(defun c:Points2Line (/ cmd p&t L n L1 L2 p_t ep_t :p1 :p2 :p1z  )
  (vl-load-com)
  (setq cmd (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (command "_.undo" "_begin")
  (if (and (princ "\nSelect points and mtexts to align")
       (setq p&t (ssget '((0 . "POINT,MTEXT,AECC_COGO_POINT"))))
       (setq L (car (entsel "\nSelect the reference line")))
       (= "LINE" (cdr (assoc 0 (entget L))))
       (or oL (setq oL 0.00))
       (setq oL (cond ((getdist (strcat "\nOffset from the line <" (rtos oL 2 2) ">: ")) )( oL ))))
    (progn
      (setq L1 (cdr (assoc 10 (entget L))))
      (setq L2 (cdr (assoc 11 (entget L))))
      (setq L1 (list (car L1) (cadr L1)))
      (setq L2 (list (car L2) (cadr L2)))
      (repeat (setq n (sslength p&t))
    (setq p_t (ssname p&t (setq n (1- n))))
    (setq ep_t (entget p_t))
    (if (= "AECC_COGO_POINT" (cdr (assoc 0 ep_t)))
      (progn
        (setq obj (vlax-ename->vla-object p_t))
        (setq :p1 (list (vlax-get-property obj 'Easting)(vlax-get-property obj 'Northing) (vlax-get-property obj 'Elevation))))
      (setq :p1 (cdr (assoc 10 ep_t))))
    (setq :p1z (last :p1) :p1 (list (car :p1) (cadr :p1)))
    (setq :p2 (LM:ProjectPointToLine :p1 L1 L2))
    (if (not (equal oL 0.0 1e-6)) (setq :p2 (polar :p2 (angle :p2 :p1) oL)))    
    (cond ((= "POINT" (cdr (assoc 0 ep_t)))
           (progn
         (setq :p2 (list (car :p2) (cadr :p2) :p1z))
         (vla-put-Coordinates (vlax-ename->vla-object p_t) (vlax-3d-point :p2))))
          ((= "MTEXT" (cdr (assoc 0 ep_t)))
           (progn
         (setq :p2 (list (car :p2) (cadr :p2) :p1z))
         (setq :p2 (polar :p2 (angle :p2 :p1) (* 1.7 (cdr (assoc 40 ep_t)))))
         (vla-put-InsertionPoint (vlax-ename->vla-object p_t) (vlax-3d-point :p2))))
          ((= "AECC_COGO_POINT" (cdr (assoc 0 ep_t)))
           (progn
         (setq :ps (list (car :p2) (cadr :p2) :p1z))
         (setq obj (vlax-ename->vla-object p_t))
         (vlax-put-property obj 'Northing (cadr :ps))
         (vlax-put-property obj 'Easting (car :ps))
         (vlax-put-property obj 'Elevation (caddr :ps))))
          )
    )
      )
    )
  (setvar 'cmdecho cmd)
  (command "_.undo" "_end")
  (princ)
  )
;; Project Point onto Line - Lee Mac
;; Projects pt onto the line defined by p1,p2
(defun LM:ProjectPointToLine ( pt p1 p2 / nm )
(setq nm (mapcar '- p2 p1)
p1 (trans p1 0 nm)
pt (trans pt 0 nm)
)
(trans (list (car p1) (cadr p1) (caddr pt)) nm 0)
)

EXAMPLE.dwg points2line.lsp

Edited by SLW210
Code Tags!
Posted

 

((= "AECC_COGO_POINT" (cdr (assoc 0 ep_t)))
           (progn
         (setq :ps (list (car :p2) (cadr :p2) :p1z))
         (setq obj (vlax-ename->vla-object p_t))
         (vlax-put-property obj 'Northing (cadr :ps))
         (vlax-put-property obj 'Easting (car :ps))
         (vlax-put-property obj 'Elevation (caddr :ps))))

 

Because this part of the code is for Civil 3D

Posted

I upgraded the CIVIL 2022 and now the code works, tenks to all

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...