Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

convert pline to 3d poly

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
271 Views, 3 Replies

convert pline to 3d poly

is it possible or does anyone have a routine that will convert a polyline to a 3d poly? i have a trail system and i know my start elevation. i want to grade it at 5%.

1. prompt to select pline
2. pick start point and give elevation
3. prompt "do want to grade at slope or give ending elevation?
4. based on no. 3 response convert polyline into a 3d poly.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

I assume you'd have to step through the Polyline vertices, check the distance between each adjacent
pair to calculate the elevation change along the segment between them, and build the 3DPolyline from
the calculated set of points. (Not that I can tell you how to do that, exactly, without figuring a
bunch of stuff out, but....) You could erase the original Pline, or not. [If the Pline has any
*arc* segments, you wouldn't be able to do it -- 3DPolylines can't have those.]
--
Kent Cooper


wrote...
is it possible or does anyone have a routine that will convert a polyline to a 3d poly? i have a
trail system and i know my start elevation. i want to grade it at 5%.

1. prompt to select pline
2. pick start point and give elevation
3. prompt "do want to grade at slope or give ending elevation?
4. based on no. 3 response convert polyline into a 3d poly.
Message 3 of 4
Anonymous
in reply to: Anonymous

ToolPac does this very quickly. Besides converting 2d to 3d, you can do a
"3D Slant" wher you give it beginning and ending (or point to point)
elevations and it adjusts all the vertices to match that grade.
(www.dotsoft.com). I'm not an advertiser or seller at all, but ToolPac has
many amazing tools that make CAD in all flavors much more powerful...

wrote in message news:5800952@discussion.autodesk.com...
is it possible or does anyone have a routine that will convert a polyline to
a 3d poly? i have a trail system and i know my start elevation. i want to
grade it at 5%.

1. prompt to select pline
2. pick start point and give elevation
3. prompt "do want to grade at slope or give ending elevation?
4. based on no. 3 response convert polyline into a 3d poly.
Message 4 of 4
devitg
in reply to: Anonymous

Try it please , it have fixed values 5% slope , +10 units 3d z origin

;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA
;;; Copyleft 1995-2005 by Gabriel Calos De Vit
;; DEVITG@GMAIL.COM

;; Hecho por Gabo CALOS DE VIT de CORDOBA ARGENTINA
;;; Copyleft 1995-2007 por Gabriel Calos De Vit
;; DEVITG@GMAIL.COM
;; and help from any where I can get


;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

(defun DT:LIST-FLATTEN (LISTE /)
(cond
((null LISTE) NIL)
((atom LISTE) (list LISTE))
(1
(append (DT:LIST-FLATTEN (car LISTE))
(DT:LIST-FLATTEN (cdr LISTE))))
)
) ;_ DT:LIST-FLATTEN

;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
(DEFUN NEW-LAY-CO (LAYER-NAME COLOR)
(setq LAY-NEW (vla-Add lay-coll LAYER-NAME))
(VLA-PUT-COLOR LAY-NEW COLOR)
(vla-put-activelayer ADOC LAY-NEW)
) ;_END NEW-LAY
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
(defun LIST->SAFEARRAY (ptList)
(vl-Load-Com)
(vlax-SafeArray-Fill
(vlax-Make-SafeArray
vlax-vbDouble
(cons 0 (1- (length ptList)))
)
ptList
)
)
;; LIST->SAFEARRAY
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
(defun en2ob (en)
(vlax-ename->vla-object en)
)
;;**************************************************************************************************
(defun 1-2-3 (lst)
(mapcar 'list lst (cdr lst))
)
;;**************************************************************************************************
(defun i:Points (ptList)
(vl-Load-Com)
(vlax-SafeArray-Fill
(vlax-Make-SafeArray
vlax-vbDouble
(cons 0 (1- (length ptList))))
ptList)
) ;_end defun
;;/------------------------------------------------------------------
(defun 3dpoly (saf-arr)
(vla-Add3Dpoly model saf-arr)
)
;;************************************************************
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
;;;Copyright ©2005 - Marc'Antonio Alessi, Italy - All rights reserved
; http://xoomer.virgilio.it/alessi
;
(defun ALE_EntSelFilter (PrmStr FltLst / FlgSlt EntNam)
(setvar "ERRNO" 0)
(princ "\n_ ")
(prompt (setq PrmStr (strcat "\n" PrmStr ": ")))
(if
(while (not FlgSlt)
(if (setq EntNam (ssget "_:E:S" FltLst))
(not (setq FlgSlt T))
(if (= 52 (getvar "ERRNO"))
(setq FlgSlt T)
(alert
;;; (strcat "\nUd no entendió lo que le pedí, pruebe de nuevo!" PrmStr )
(strcat "\nYou did not understood what I ask for , try it again!"
PrmStr)
)
) ;_if
) ;_if
) ;_while
(not (princ "\nFunction cancelled. "))
(ssname EntNam 0)
) ;_if
) ;_defun
;;usage

;;(ALE_EntSelFilter "Seleccione la poly del terreno" '((0 . "POLYLINE") (100 . "AcDb3dPolyline")))
;;************************************************************************************************************************************************




(defun c:2d->3d-by-slope (
;;acRed ADOC DIST-1-2 LIST-PT LIST-VAR LISTA LISTA-SIMPLE MODEL POINT-PAIR POLY-COOR POLY-COOR-XY POLY-ENT POLY-OBJ POLY-XY-LIST PT-LIST PT1 PT2 PT2-Z SLOPE Z-START
)



(setq slope 0.05)
(setq z-start (list 10))
(vl-load-com)
(setq adoc
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(setq model (vla-get-modelspace adoc))
(setq poly-ent (ALE_EntSelFilter
"Select the pline"
'((0 . "LWPOLYLINE") (100 . "AcDbEntity"))))
(setq poly-obj (EN2OB poly-ent))
(setq poly-coor (vla-get-coordinates poly-obj))
(setq poly-coor-xy (VAR->LST poly-coor))
(setq poly-xy-list (GROUP-BY-NUM poly-coor-xy 2))
(setq point-pair (1-2-3 poly-xy-list))
(setq pt-list nil)
(foreach pair point-pair
(setq dist-1-2 (distance (car pair) (cadr pair)))
(setq pt1 (append (car pair) z-start))
(setq pt-list (cons pt1 pt-list))
(setq pt2-z (list (+ (car z-start) (* dist-1-2 slope))))
(setq pt2 (append (cadr pair) pt2-z))
(setq z-start pt2-z)
(setq pt-list (cons pt2 pt-list))
(setq list-pt (reverse pt-list))
) ;_ foreach
(setq lista-simple (REMOVE_DOUBLES list-pt))
(setq lista (DT:LIST-FLATTEN lista-simple))
(setq list-var (i:Points lista))
(NEW-LAY-CO "3dpoly-lay" acred)
(3dpoly list-var)
);_ end main funtion
(defun c:2d3d ()
(c:2d->3d-by-slope)
)

(alert " put \n 2d3d \n at the command line ")

;|«Visual LISP© Format Options»
(120 2 50 0 nil "end of " 60 9 0 0 0 T T nil T)
;*** DO NOT add text below the comment! ***|;

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost