Author Topic: help!  (Read 2736 times)

0 Members and 1 Guest are viewing this topic.

Q1241274614

  • Guest
help!
« on: October 29, 2012, 11:23:30 AM »

(VL-CMDF "_SPLINE")
       (mapcar 'command pt_mlist_01)
       (VL-CMDF "" "" "")
« Last Edit: November 02, 2012, 11:01:07 AM by Q1241274614 »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10366
Re: By POLYLINE node is converted to spline, use entmake to generate spline.
« Reply #1 on: October 29, 2012, 12:10:34 PM »
Example:
Code: [Select]
;;  Add Spline
(defun c:test ( / *mspace* p pts spline)
  (setq *mspace*
    (vla-get-ModelSpace
      (vla-get-ActiveDocument
        (vlax-get-acad-object)
      )
    )
  )
  (setq p (getpoint "\nPick point: "))
  (while (setq p (getpoint p "\nPick point: ")) (setq pts (cons p pts)))
  (setq pts (append pts (list (car pts))))
 
  (setq spline
    (vlax-invoke *mspace* 'AddSpline (apply 'append pts)
      '(0.0 0.0 0.0) '(0.0 0.0 0.0)
    )
  )
  (setq fd (vlax-curve-getFirstDeriv spline 0))
  (vlax-put spline 'StartTangent fd)
  (vlax-put spline 'EndTangent fd)
  (princ)
)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Tharwat

  • Swamp Rat
  • Posts: 518
  • Hypersensitive
Hope this helps . :)

Code - Auto/Visual Lisp: [Select]
  1. (defun c:Pl2Sp (/ pl pts s)
  2. ;;; Tharwat 29. Oct. 2012 ;;;
  3.   (if (and (setq pl (car (entsel "\n Select Polyline :")))
  4.            (eq (cdr (assoc 0 (entget pl))) "LWPOLYLINE")
  5.       )
  6.     (progn
  7.       (mapcar '(lambda (x)
  8.                  (if (eq (car x) 10)
  9.                    (setq pts (cons (list (cadr x) (caddr x)) pts))
  10.                  )
  11.                )
  12.               (entget pl)
  13.       )
  14.       (setq s (entmake
  15.                 (append
  16.                   (list
  17.                     '(0 . "SPLINE")
  18.                     '(100 . "AcDbEntity")
  19.                     '(100 . "AcDbSpline")
  20.                     (cons 70 (length pts))
  21.                     '(71 . 3)
  22.                     (cons 74 (length pts))
  23.                     '(44 . 1.0e-010)
  24.                   )
  25.                   (mapcar '(lambda (x) (cons 11 x)) pts)
  26.                 )
  27.               )
  28.       )
  29.     )
  30.     (princ "\n Nothing selected or not LWpolyline ")
  31.   )
  32.   (if s
  33.     (entdel pl)
  34.   )
  35.   (princ)
  36. )
  37.  
« Last Edit: October 29, 2012, 12:53:19 PM by Tharwat »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10366
Good one, but "LWPOLYLINE" may be better as it won't work with 3D or heavy plines.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Tharwat

  • Swamp Rat
  • Posts: 518
  • Hypersensitive
Good one, but "LWPOLYLINE" may be better as it won't work with 3D or heavy plines.
Thanks CAB .

CODE UPDATED

Stefan

  • Bull Frog
  • Posts: 220
For every type of open Polyline
Code - Auto/Visual Lisp: [Select]
  1. (defun C:PL2SPL ( / ss i)
  2.   (if
  3.     (setq ss (ssget '((0 . "*POLYLINE"))))
  4.     (repeat (setq i (sslength ss))
  5.       (make_spline
  6.         (pl_list (ssname ss (setq i (1- i))))
  7.       )
  8.     )
  9.   )
  10.   (princ)
  11. )
  12.  
  13. (defun pl_list (e / r i)
  14.     (setq r (cons (cons 11 (vlax-curve-GetPointAtParam e (setq i (1- i)))) r))
  15.     )
  16.   r
  17. )
  18.  
  19. (defun make_spline (l)
  20.     (append
  21.       (list
  22.         '(0 . "SPLINE")
  23.         '(100 . "AcDbEntity")
  24.         '(100 . "AcDbSpline")
  25.         '(71 . 3)
  26.         (cons 74 (length l))
  27.         '(44 . 1.0e-005)
  28.       )
  29.       l
  30.     )
  31.   )
  32. )
For the closed ones, dxf code 70 must be set to a proper value.
Well, they have changed Splines in Acad2012 but DXF reference is the old one, with an incomplete description for dxf code 70.
If somebody has a newer version of DXF reference, I'll be glad if he'll share it with us.

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
If somebody has a newer version of DXF reference, I'll be glad if he'll share it with us.

AutoCAD Exchange DXF Reference

Stefan

  • Bull Frog
  • Posts: 220
If somebody has a newer version of DXF reference, I'll be glad if he'll share it with us.

AutoCAD Exchange DXF Reference
Thank you Lee. I have that one but is incomplete. How do you explain this?

MP

  • Seagull
  • Posts: 17454
How do you explain this?

Autodesk's robust QA/QC department.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Tharwat

  • Swamp Rat
  • Posts: 518
  • Hypersensitive
The same in 2013 .


Stefan

  • Bull Frog
  • Posts: 220
Well, we can try to decode the secret.
Here is the same 3d Spline, closed in left and open in right.

Q1241274614

  • Guest
thank