Jump to content

Info by cogo point #


thereisnotime

Recommended Posts

A brief overview of what's going on here:

 

  1. user will select their points
  2. run the command
  3. once the LISP encounters a point description with "CNF" or "DEC", it places a block with text

Now the next step is to grab the next 2 sequential points and get their X&Y coordinates so I can measure the distance between the two, but I'm kind of stuck on how to do that. Any help would be appreciated.

 

 

(defun c:desc2 (/ ss x northng pnt eastng descr dist hndl eastng1 eastng2 northng1 northng2)
  (vl-load-com)
  (if (ssget ":S:E" '((0 . "AECC_COGO_POINT")))
     (progn
        (vlax-for x
           (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
           (setq pnt (vlax-get x 'number)
              eastng (vlax-get x 'easting)
              northng (vlax-get x 'northing)
              descr (vlax-get x 'rawdescription)
              hndl (vlax-get x 'handle)
           );END setq
           (if
              (= 0 (vl-string-search "DEC" descr))
                 (progn
                    (command "text" "c" (list eastng northng) 0.5 0 descr)
                    (command  "_insert" "nf_shrub_decid" (list eastng northng) "" "" "")
                    (setq pnt1 (+ 1 pnt)
                          pnt2 (+ 2 pnt)
                    )
                 );END if TRUE
                 (progn
                    (if
                       (= 0 (vl-string-search "CNF" descr))
                          (progn
                             (command "text" "c" (list eastng northng) 0.5 0 descr)
                             (command  "_insert" "nf_shrub_conifer" (list eastng northng) "" "" "")
                          );END if TRUE
                    );END if
                 );END if FALSE
           );END if
        );END vlax-for
     );END progn
  );END if
  (princ)
)

Link to comment
Share on other sites

I don't have Civil, but based on your code, you can try something like this :

 

(defun c:desc2 ( / ss x northng pnt eastng descr dist hndl eastng1 eastng2 northng1 northng2 pnt1 pnt2 easting1 nothing1 easting2 northing2 )
  (vl-load-com)
  (if (ssget ":S:E" '((0 . "AECC_COGO_POINT")))
     (progn
        (vlax-for x
           (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
           (setq pnt (vlax-get x 'number)
              eastng (vlax-get x 'easting)
              northng (vlax-get x 'northing)
              descr (vlax-get x 'rawdescription)
              hndl (vlax-get x 'handle)
           );END setq
           (if
              (= 0 (vl-string-search "DEC" descr))
                 (progn
                    (command "text" "c" (list eastng northng) 0.5 0 descr)
                    (command  "_insert" "nf_shrub_decid" (list eastng northng) "" "" "")
                    (setq pnt1 (+ 1 pnt)
                          pnt2 (+ 2 pnt)
                    )
                    (vlax-for p ss
                       (if (= pnt1 (vlax-get p 'number))
                          (progn
                             (setq easting1 (vlax-get p 'easting))
                             (setq northing1 (vlax-get p 'northing))
                          )
                       )
                       (if (= pnt2 (vlax-get p 'number))
                          (progn
                             (setq easting2 (vlax-get p 'easting))
                             (setq northing2 (vlax-get p 'northing))
                          )
                       )
                    )
                 );END if TRUE
                 (progn
                    (if
                       (= 0 (vl-string-search "CNF" descr))
                          (progn
                             (command "text" "c" (list eastng northng) 0.5 0 descr)
                             (command  "_insert" "nf_shrub_conifer" (list eastng northng) "" "" "")
                          );END if TRUE
                    );END if
                 );END if FALSE
           );END if
        );END vlax-for
     );END progn
  );END if
  (prompt "\nDistance is : ") (princ (rtos (distance (list easting1 northing1) (list easting2 northing2)) 2 20))
  (princ)
)

 

HTH, M.R.

Link to comment
Share on other sites

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...