TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: milanp on September 22, 2020, 06:02:53 PM

Title: Block on Cogo point
Post by: milanp on September 22, 2020, 06:02:53 PM
Hello

I use this lisp to put a specific block on a selected point. Does anyone have any idea how this can be applied to COGO points in Civil3d. Thanks!


Code: [Select]
(defun C:k1 ( / ss blk n)

  (if (and (setq ss (ssget '((0 . "POINT"))))
            (setq blk "T62-04"))
    (repeat (setq n (sslength ss))
(command "layer" "make" "T62-04" "")
      (command "_.-insert" blk
                "_s" 1
                "_r" 0
                "_none" (cdr (assoc 10 (entget (ssname ss (setq n (1-
n)))))))))
  (princ)
)
Title: Re: Block on Cogo point
Post by: Dlanor on September 22, 2020, 06:39:51 PM
I don't use civil but have you tried using "AECC_COGO_POINT" instead of "POINT" in the ssget?
Title: Re: Block on Cogo point
Post by: HOSNEYALAA on September 22, 2020, 06:58:15 PM
Code: [Select]
   (setq ptObj (vlax-ename->vla-object (ssname ss n))
   (setq desc  (vlax-put ptObj 'rawdescription " ttyt"))
 
 

Title: Re: Block on Cogo point
Post by: HOSNEYALAA on September 22, 2020, 07:04:23 PM
https://www.theswamp.org/index.php?topic=55528.0
Title: Re: Block on Cogo point
Post by: BIGAL on September 22, 2020, 08:29:41 PM
The cogo point you can use EASTING NORTHING for insertion point or LOCATION using VL-get method. You can use point DESCRIPTION also once you have selection set, NUMBER also.
Title: Re: Block on Cogo point
Post by: milanp on September 23, 2020, 06:18:45 PM
I couldn't solve it. This is the only way I have found a solution

Code: [Select]
(defun c:k1 ( / blk pt)
  (if (and (setq blk "T62-04")
           (setq pt (getpoint "\nSpecify insertion point: "))
           )
    (command "_.insert" blk "_S" 1 "_R" 0 "_NONE" pt)
    )
  (princ)
  )
Title: Re: Block on Cogo point
Post by: HOSNEYALAA on September 24, 2020, 02:43:36 AM

Code: [Select]

(defun c:k1 ( / blk pt)
  (if (and (setq blk "T62-04")
   (setq eName (vlax-ename->vla-object(car (entsel "\nSelect a AECC_COGO_POINT "))))
           (setq pt (mapcar '(lambda ( p ) (vlax-get eName p)) '( easting northing elevation)))
           )
    (command "_.insert" blk "_S" 1 "_R" 0 "_NONE" pt)
    )
  (princ)
  )


Title: Re: Block on Cogo point
Post by: HOSNEYALAA on September 24, 2020, 02:44:22 AM
HI
Title: Re: Block on Cogo point
Post by: milanp on September 24, 2020, 05:18:42 AM
Everything works great! Thank you very much!  :-)
Title: Re: Block on Cogo point
Post by: alanjt on September 24, 2020, 09:08:28 AM
Is there an aversion to creating a style you can assign to the point? All of which could show the block and label, and be dynamically linked. You could even create a description code to auto assign the style to the point matching a specific raw description (if that's something you're doing).
Title: Re: Block on Cogo point
Post by: milanp on September 24, 2020, 03:54:17 PM
I use that method if the surveyor is automatically assigned descriptions in the field during the survey. This is not the case now and I enter the blocks manually in dwg model space. Blocks are also assigned in places that are not measured in the field, so I cannot add a description in the txt file of points. Thanks for the advice