Jump to content

Help lisp Auto Dimension


Recommended Posts

Posted

Hi, everybody.

I draw a polyline, on which are the any blocks with the blocks (Case 1) or different line, polyline, xline (Case 2).....

Please help me a lisp Auto dimension as file attach.

Thank you very much!

File:

Autodimension.dwg

Posted

The simple answer is in using ssget "F" this creates a list of objects crossing a pline then a intersect with the obvious way is to do it for block insert pt, circle, line/pline crossing.

 

Some one your welcome to jump in I need to paste together 3 programs will take time.

Posted
The simple answer is in using ssget "F" this creates a list of objects crossing a pline then a intersect with the obvious way is to do it for block insert pt, circle, line/pline crossing.

 

Some one your welcome to jump in I need to paste together 3 programs will take time.

 

Thank BIGAL very much!

Very happy to get help from BIGAL.

I do not know how to write lisp need your help is very good.

Please help me, thank BIGAL again.

Posted
Bit busy right now any one else ?

 

Thank BIGAL very much!

Hope someone help me!

Thank for all.

Posted

here is a start use the simple test of divide a pline and creating points along it and return the co-ords of the points. Use multiple if's or a COND would be neater

 

; 1st step to find objects along a pline
; by Alan H
(defun pointpline ( / ss x obj pt co-ordsxy)
(if (not co-ords2xy) (load "pline co-ords"))
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy)

(setq ss (ssget "F" co-ordsxy))
(setq x (sslength ss))
(repeat (sslength ss)
(setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1)))))
(if (= "AcDbPoint" (vla-get-objectname obj))
(setq pt (vlax-safearray->list (vlax-variant-value (vla-get-Coordinates obj))))
)
(princ pt)
)
)
(pointpline)

and you will need this

; pline co-ords example
; by Alan H
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq numb (/ (length co-ords) 2))
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)

; program starts here
;(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
;(co-ords2xy)

Posted
here is a start use the simple test of divide a pline and creating points along it and return the co-ords of the points. Use multiple if's or a COND would be neater

 

; 1st step to find objects along a pline
; by Alan H
(defun pointpline ( / ss x obj pt co-ordsxy)
(if (not co-ords2xy) (load "pline co-ords"))
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy)

(setq ss (ssget "F" co-ordsxy))
(setq x (sslength ss))
(repeat (sslength ss)
(setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1)))))
(if (= "AcDbPoint" (vla-get-objectname obj))
(setq pt (vlax-safearray->list (vlax-variant-value (vla-get-Coordinates obj))))
)
(princ pt)
)
)
(pointpline)

and you will need this

; pline co-ords example
; by Alan H
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq numb (/ (length co-ords) 2))
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)

; program starts here
;(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
;(co-ords2xy)

Thank BIGAL very much! Thank for help me.

I in turn run two lisp (getcoords.lsp and pointpline.lsp_I copy and save as to lisp). But didn't result (result: please pick plinenilnilnilnilnilnilnil). Didn't know i was wrong anywhere.

Please, help me.

Thank you very much! Good luck for you!

getcoords.lsp

pointpline.lsp

Posted

The example was for testing, draw a Pline, then DIVIDE 10, then DDPTYE pick a shape then run program. The 10 co-ords should appear on the screen the next step would be to add blocks and finally add the Intersectwith for crossing objects.

Posted

Code for a block

(if (= "AcDbBlockReference" (vla-get-objectname obj))
(setq pt (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint obj))))
)

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