Jump to content

Recommended Posts

Posted

Hi,

 

I need to add a lot of spot height in a road pavement an I would like to use a lisp.

 

In need to add 2 spot value under the kerb line.

 

The first one (11.11 ex.) in under the kerb the second one (22.22 ex.) is below the kerb.

 

I built a block with 2 prompt values:

 

STREET.dwg

 

Height_1=11.11

Height_2: 22.22

 

This lisp should work:

 

1: PICK THE INSERTION POINT.

2: PICK THE FIST VALUE (Height_1)

3: PICK THE SECOND VALUE (Height_2)

 

Usually i used the follow lisp but it is able to add just one value at time.

 

(defun c:CRC (/ sp p)
 ;; Tharwat 15.Feb.2016 ;;
 (setq sp
        (vlax-get (vla-get-activelayout
                    (vla-get-ActiveDocument (vlax-get-acad-object)))
                  'Block)
       )
 (if (tblsearch "BLOCK" "STREET" )
   (while (setq p (getpoint "\nSpecify point :"))
     (vla-put-textstring
       (car (vlax-invoke
              (vla-insertblock
                sp
                (vlax-3d-point p)
                "STREET"
                1.0
                1.0
                1.0
                0.0)
              'getattributes))
       
(rtos (/ (caddr p) 1000.) 2 2)
       )

     )
   )
 (princ)
 )(vl-load-com)

 

 

lisp.jpg

 

 

Thanks in advance

Posted

I would use:

 

(setvar "ATTDIA" 0 )
(setvar "ATTREQ" 1 )
(command "-insert" "STREET" p "1" "1" "0")

 

Because of the ATTREQ variable when inserting the block itll ask for the attributes.

Posted

Thanks, unfortunately I don't know the Lisp code. Can you suggest me how I need to modify the lisp?

 

Thanks

Posted

Hi,

 

Are you after picking two points then write them into the Attributed block 'STREET' in order ?

Posted
(defun c:CRC (/ sp p)
(if (tblsearch "BLOCK" "STREET" )
	(progn
		(setq p (getpoint "\nSpecify point :"))
		(setvar "ATTDIA" 0 )
		(setvar "ATTREQ" 1 )
		(command "-insert" "STREET" p "1" "1" "0")
	)
)
(princ)
)
(vl-load-com)

Posted

Hi @Aftertouch,

 

this work well but i need to add the value manually. I would like to pick 2 point, get the z value, and use it to fill the attribute values

 

Thanks

Posted
yes, i would like to do this.

 

(defun c:crc (/ sp p p1 p2 ats)
 ;; Tharwat 10.Mar.2017 ;;
 (setq sp
        (vlax-get (vla-get-activelayout
                    (vla-get-activedocument (vlax-get-acad-object))
                  )
                  'block
        )
 )
 (if (tblsearch "BLOCK" "STREET")
   (while (and (setq p (getpoint "\nSpecify insertion point :"))
               (setq p1 (getpoint "\nSpecify 1st point :"))
               (setq p2 (getpoint "\nSpecify 2nd point :"))
          )
     (setq ats (vlax-invoke
                 (vla-insertblock
                   sp
                   (vlax-3d-point p)
                   "STREET"
                   1.0
                   1.0
                   1.0
                   0.0
                 )
                 'getattributes
               )
     )
     (mapcar
       '(lambda (at)
          (vla-put-textstring
            at
            (rtos (/ (caddr (if (= (vla-get-tagstring at) "Height_1")
                              p1
                              p2
                            )
                     )
                     1000.
                  )
                  2
                  2
            )
          )
        )
       ats
     )
   )
 )
 (princ)
)(vl-load-com)

Posted

Sorry, i misunderstood the question. :-)

Posted

Tharwat, thanks for that.

 

i tried the lisp but i get the same height values in two different point with different z value.

Posted
Tharwat, thanks for that.

 

i tried the lisp but i get the same height values in two different point with different z value.

 

So is that what you wanted or you still in need of any changes?

Posted (edited)

I would like to add the z value of the first point in Height_1 and the z value of the 2nd point on Height_2. Right now your new version of the lisp copy the first z value on both the place (Height_1 and Height_2).

 

Thanks

 

ADD.jpg

Edited by whosa
Posted
(if (= (vla-get-tagstring at) "Height_1")
                              p1
                              p2
                            )

 

I would like to add the z value of the first point in Height_1 and the z value of the 2nd point on Height_2

 

That's what the program does and you can have a look at the above part of codes which means if the tag name is equal to "Height_1" then get the Z coordinate of point one ( p1 ) otherwise get Z of ( p2 ).

Posted

The tag name is 11.11 and not Height_1 or Height_2

 

So just change the string in my last posted codes "Height_1" to "11.11"

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