Author Topic: How to entmake a polyline  (Read 10786 times)

0 Members and 2 Guests are viewing this topic.

DEVITG

  • Bull Frog
  • Posts: 481
How to entmake a polyline
« on: April 20, 2006, 07:12:57 PM »
I have this two list holding the points coordinates and the bulge factor of a TO BE polyline.

Code: [Select]
(setq ptnlist (list '(66.8823 62.975) '(123.03 109.175) '(160.462 152.625) '(236.978 165.825) '(263.951 212.025) '(334.962 221.925) '(347.072 230.725) '(473.681 217.525) '(475.883 187.825) '(452.763 124.025) '(378.449 95.425) '(292.576 52.525)))

(setq pt-qty (length ptnlist))


(setq blg-factor ' (0.0 0.0 0.0 0.465609 -1.22874 0.0 0.0 0.0 0.0 0.0 0.0 0.0))

(setq blg-qty (length blg-factor))
       


How can I build the poly by ENTMAKE or other way aviable??

 Thanks in advance
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How to entmake a polyline
« Reply #1 on: April 20, 2006, 07:41:31 PM »
Will this be a LWPolyline or a standard polyline? The procedure is different for each of them
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to entmake a polyline
« Reply #2 on: April 20, 2006, 07:46:56 PM »
Something like this ?

Code: [Select]
(SETQ point-list (LIST '(66.8823 62.975)         '(123.03 109.175)
                       '(160.462 152.625)        '(236.978 165.825)
                       '(263.951 212.025)        '(334.962 221.925)
                       '(347.072 230.725)        '(473.681 217.525)
                       '(475.883 187.825)        '(452.763 124.025)
                       '(378.449 95.425)         '(292.576 52.525)
                      )
)

(SETQ bulge-list
        '(0.0 0.0 0.0 0.465609 -1.22874 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
)



(ENTMAKE
   (APPLY
      (FUNCTION APPEND)
      (CONS (LIST '(0 . "LWPOLYLINE")
                  '(100 . "AcDbEntity")
                  '(67 . 0)
                  '(410 . "Model")
                  '(8 . "0")
                  ;; '(6 . "HIDDEN")              ; Linetype
                  ;;  (cons 62 acyellow)             ; Color
                  '(100 . "AcDbPolyline")
                  (CONS 90 (LENGTH point-list))   ; Vertices
                  '(70 . 0)
                  ;;'(70 . 1)                     ; Closed
            )
            (MAPCAR (FUNCTION LIST)
                    (MAPCAR (FUNCTION (LAMBDA (a) (CONS 10 a))) point-list)                   
                    (MAPCAR (FUNCTION (LAMBDA (b) (CONS 42 b))) bulge-list)
            )
      )
   )
)

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

DEVITG

  • Bull Frog
  • Posts: 481
Re: How to entmake a polyline
« Reply #3 on: April 20, 2006, 08:13:00 PM »
Hi Kerry , that is what I need ,
Thanks for it.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: How to entmake a polyline
« Reply #5 on: April 21, 2006, 04:40:34 AM »
Or the same procedure in Vlisp... :-)
Code: [Select]
(setq PolObj (vlax-invoke
              (vla-get-ModelSpace
               (vla-get-ActiveDocument
                (vlax-get-acad-object)
               )
              )
              'AddLightWeightPolyline
              (apply 'append point-list)
             )
      SegCnt -1
)
(mapcar
'(lambda (l)
  (vla-SetBulge PolObj (setq SegCnt (1+ SegCnt)) l)
 ) bulge-list
)
;;;(vla-put-Closed PolObj :vlax-true)
;;;(vla-put-Layer PolObj "0")
;;;(vla-put-Color PolObj AcYellow)
;;;(vla-put-Linetype PolObj "HIDDEN")
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to entmake a polyline
« Reply #6 on: April 21, 2006, 05:04:50 AM »
Hi Jürg ,

personally , essentially that's the way I do it too.
I learnt using entmake, 'cause the ActiveX stuff wasn't available till Basis brought out VitalLisp.
... much prefer the vla stuff since then, mainly for it's transparency, even though it's a little slower in some cases.

I've noticed from a look at your site that you appear to prefer it too ! :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: How to entmake a polyline
« Reply #7 on: April 21, 2006, 09:05:21 AM »
(...) much prefer the vla stuff since then, mainly for it's transparency, even though it's a little slower in some cases. (...)
You say the facts in a couple of words, absolutely agree... :-)
There is also another reason for me why I use the Vlisp stuff.
Because I'm working also with VBA, it's easier to switch between both languages.
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

DEVITG

  • Bull Frog
  • Posts: 481
Re: How to entmake a polyline
« Reply #8 on: April 21, 2006, 04:27:55 PM »
Thanks to all you friends.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to entmake a polyline
« Reply #9 on: April 22, 2006, 02:31:28 AM »
If the coordinate system not the world to create a polyline, other program is necessary!
Code: [Select]
;Change a coordinate system with world(global) on another
(While (setq pt (getpoint))
  (setq lst (cons pt lst))
) ;_  While
(setq lst (reverse lst))
;Creation of the polyline
(entmakex
  (apply 'append
         (list
           (list
             '(0 . "LWPOLYLINE")
             '(100 . "AcDbEntity")
             '(62 . 1)
             '(100 . "AcDbPolyline")
             (cons 90 (length lst))
             (cons 38 (caddr (trans '(0 0 0) 1 (trans '(0. 0. 1.) 1 0))))
             '(70 . 1)
           ) ;_  list
           (mapcar '(lambda (x) (list 10 (car x) (cadr x)))
                   (mapcar '(lambda (x) (trans x 1 (trans '(0. 0. 1.) 1 0))) lst)
           ) ;_  mapcar
           (list (cons 210 (trans '(0. 0. 1.) 1 0)))
         ) ;_  list
  ) ;_  apply
) ;_  setq
To create a projection all polylines to a plane 0,0,1 in a world(global) coordinate system:
Code: [Select]
(defun c:lw-osc-usc (/ LST N SSET X X1)
  (if (setq SSET (ssget "_X" '((0 . "LWPOLYLINE"))))
    (foreach x (mapcar
           (function vlax-ename->vla-object)
           (vl-remove-if
             (function listp)
             (mapcar (function cadr) (ssnamex sset))
           ) ;_ vl-remove-if
            ) ;_  mapcar
      (setq
     n   (vlax-safearray->list
           (vlax-variant-value (vla-get-normal x))
         ) ;_  vlax-safearray->list
     e (vla-get-elevation x)
     lst (apply 'append
             (mapcar '(lambda (x)
                     ((lambda (x1) (list (car x1) (cadr x1)))
                    (trans (list (car x)(cadr x)e) 0 (trans '(0. 0. 1.) n 0))
                     )
                   ) ;_  lambda
                  (2d-lw-pt (vlax-safearray->list
                           (vlax-variant-value (vla-get-coordinates x))
                         ) ;_  vlax-safearray->list
                  )
             ) ;_  mapcar
         ) ;_  apply
      ) ;_  setq
      (vla-put-Coordinates
     x
     (vlax-safearray-fill
       (vlax-make-safearray vlax-vbDouble
                      (cons 0 (1- (length lst)))
       ) ;_  vlax-make-safearray
       lst
     ) ;_  vlax-safearray-fill
      ) ;_  vla-put-Coordinates
      (vla-put-elevation x 0.)
      (vla-put-normal x (vlax-3d-point 0. 0. 1.))
      (vla-update x)
    ) ;_  foreach
  ) ;_  if
) ;_  defun
(defun 2d-lw-pt (lst)
    (if lst
      (cons (list (car lst) (cadr lst)) (2d-lw-pt (cddr lst)))
    ) ;_  if
  )
(c:lw-osc-usc)
Good luck