I first tried Lion's but it seamed like autocad locked up on me, then I tried Cab's suggestion and it worked perfectly.
Thanks, you saved me a bunch of time!!!
|
I first tried Lion's but it seamed like autocad locked up on me, then I tried Cab's suggestion and it worked perfectly.
Thanks, you saved me a bunch of time!!!
Here is a 3dto2d function using activeX
After flattening the 3dpoly's you could try using the express tools "overkill" to join them together.
You can also use a pjoin.lsp routine to join them.
Code:(defun C:3DTo2D (/ intCount lstCoordiantes objDocument obj2dPolyline obj3dPolyline ssSelections strProperty ) (if (setq ssSelections (ssget (list (cons 0 "polyline")))) (vlax-for obj3dPolyline (vla-get-activeselectionset (setq objDocument (vla-get-activedocument (vlax-get-acad-object)))) (if (= (vla-get-objectname obj3dPolyline) "AcDb3dPolyline") (progn (setq intCount 0 lstCoordinates (mapcar '(lambda (sngCoordinate) (if (= (/ (setq intCount (1+ intCount)) 3.0) (/ intCount 3) ) nil sngCoordinate ) ) (vlax-get obj3dPolyline "coordinates") ) lstCoordinates (vl-remove nil lstCoordinates) obj2dPolyline (vla-addlightweightpolyline (vla-get-block (vla-get-activelayout objDocument)) (listtosafearray 5 lstCoordinates)) ) (foreach strProperty (list "truecolor" "layer" "linetype" "closed") (vlax-put obj2dPolyline strProperty (vlax-get obj3dPolyline strProperty)) ) (vla-delete obj3dPolyline) ) ) ) ) (princ) ) ; This function creates a safearray from a list and the safearray type symbol ; for example: (listtosafearray vlax-vbinteger (list 0) ) (defun ListToSafeArray (symSafeArrayType lstItems / safArray) (setq safArray (vlax-make-safearray symSafeArrayType (cons 0 (1- (length lstItems))))) (vlax-safearray-fill safArray lstItems) ) ;vlax-vbInteger (2) Integer ;vlax-vbLong (3) Long integer ;vlax-vbSingle (4) Single-precision floating-point number ;vlax-vbDouble (5) Double-precision floating-point number ;vlax-vbString (8) String ;vlax-vbObject (9) Object ;vlax-vbBoolean (11) Boolean ;vlax-vbVariant (12) Variant (princ "C:3dTo2d") (prin1)
I will try your routine once I get back in the office on Tuesday to see which way is faster. Happy New Year.
I suggest using the Flatten lisp program, then the pljoin lisp program.
Here's one I wrote a long time ago.
[ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]Code:(DEFUN C:GPJ (/ PT1 PT2 SSET SSETN PLN LP ENT LA PLN2 TFC CV ENTL EVS SV EVT VE1 VE2 SI1 SI2 SII1 SII2 SI SII PF FB FE FLTR) (PROMPT "*GROUP POLYLINE JOIN*") (SETQ SSET (SSGET '((0 . "LWPOLYLINE")))) (SETQ SSETN (SSLENGTH SSET)) (SETQ PLN SSETN) (PRINT SSETN) (PROMPT " POLYLINES SELECTED") (SETQ SSETN (- SSETN 1)) (SETQ LOOP 1) (WHILE LOOP (SETQ ENT (SSNAME SSET SSETN)) (SETQ LA (ASSOC 8 (ENTGET ENT))) (SETQ ENTL (ENTGET ENT)) (SETQ VE1 (CDR (ASSOC 10 ENTL))) (SETQ EVS VE1) (SETQ SV 1) (WHILE SV (SETQ ENTL (CDR ENTL)) (SETQ EVT (ASSOC 10 ENTL)) (IF (/= EVT NIL) (SETQ VE2 (CDR EVT)) (SETQ SV NIL) ) ) ;END WHILE SV (SETQ SI1 (MAPCAR '+ '(0.1 0.1 0.0) VE1)) (SETQ SI2 (MAPCAR '+ '(-0.1 -0.1 0.0) VE1)) (SETQ SII1 (MAPCAR '+ '(0.1 0.1 0.0) VE2)) (SETQ SII2 (MAPCAR '+ '(-0.1 -0.1 0.0) VE2)) (SETQ PF '(0 . "LWPOLYLINE")) (SETQ FB '(-4 . "<AND")) (SETQ FE '(-4 . "AND>")) (SETQ FLTR (LIST FB PF LA FE)) (SETQ SI (SSGET "C" SI1 SI2 FLTR)) (SETQ SII (SSGET "C" SII1 SII2 FLTR)) (IF (= SI NIL) (SETQ SI ENT) ) (IF (= SII NIL) (SETQ SII ENT) ) (SETQ CV (CDR (ASSOC 70 (ENTGET ENT)))) (IF (> CV 0) (SETQ TFC 1) (SETQ TFC 0) ) (IF (= TFC 0) (COMMAND "PEDIT" ENT "J" SI SII "" "X") ) (SETQ LP 1) (WHILE LP (SETQ SSETN (- SSETN 1)) (PROMPT "\nJOIN ATEMPT # ") (PRINC SSETN) (IF (/= (SSNAME SSET SSETN) NIL) (SETQ NT (ENTGET (SSNAME SSET SSETN))) (SETQ NT 1) ) (IF (= NT NIL) (SETQ LP 1) (SETQ LP NIL) ) (IF (< SSETN 0) (SETQ LOOP NIL) ) ) ;END WHILE LP ) ;END WHILE LOOP (SETQ SSET NIL) (SETQ SSET NIL) (PRINC) ) ;END JPL
Last edited by Mike.Perry; 2007-01-02 at 06:45 AM. Reason: [CODE] tags added.
I tried the programs by Peter and CAB and both work very well but Peter's is about twice as fast, I guess its because of Active X commands.
Thanks to all who helped, you saved me a ton of time!
Oh, that's not my lisp. I just posted the link.
Glad you got what you needed.