Тема: Как убрать высоту линий
Мне передали планы в dwg экспортом из Архикада. Многие линии имеют высоту, которую не могу убрать. Что можете посоветовать. У меня 2008.
Информационный портал для профессионалов в области САПР
Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.
Форумы CADUser → Приемы работы → Импорт и экспорт данных → Как убрать высоту линий
Страницы 1
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Мне передали планы в dwg экспортом из Архикада. Многие линии имеют высоту, которую не могу убрать. Что можете посоветовать. У меня 2008.
Может тебе это поможет:
;;;программа для обнуления Z-координаты объектов.
;;;Работает почти со всеми примитивами AutoCAD
;;;кроме регионов и еще пары мало используемых :)
;;;Замечания и предложения присылайте по адресу
;;; jurasic@yandex.ru или icq 106032532
;;;в программе использованны функции взятые
;;; с сайта http://acadx.com/
(vl-load-com)
;;;________________________________________________________________________________
(mapcar 'vl-doc-export
'(DOING_FLATTEN C:FLATTEN_EM_ALL_DBLCLK
C:FLATTEN_EM_ALL ;|vlxx-ActiveUcs|;
vlxx-AcadObject vlxx-ActiveDocument
modify_xline4 modify_xline3
modify_xline2 modify_xline1
modify_xline33 modify_SPLINE
)
)
;;;________________________________________________________________________________(vlr-remove *JUMouseReactor*)
;;;__________________________________________________________________________
(setq *vlxx-acadobject* nil) ; Initialize global variable
(defun vlxx-AcadObject ()
(cond
(*vlxx-acadobject*) ; Return the cached object
(T (setq *vlxx-acadobject* (vlax-Get-Acad-Object)))
)
)
;____________________________________________________________________________
(setq *vlxx-activedocument* nil) ; Initialize global variable
(defun vlxx-ActiveDocument ()
(cond
(*vlxx-activedocument*) ; Return the cached object
(T
(setq *vlxx-activedocument*
(vla-Get-ActiveDocument (vlxx-AcadObject))
)
)
)
)
(defun vlxx-ActiveUcs ()
(setq *vlxx-activeucs* (vla-get-ActiveUCS *vlxx-activedocument*))
)
(setq *JUAcad* (vlxx-AcadObject)
*JUActiveDoc* (vlxx-activedocument)
; *JUActiveUCS* (vlxx-ActiveUcs)
)
;xxx
(defun DOING_FLATTEN (SEL)
(progn
(setq J_DO nil)
(setq ListOffLoadedArx (mapcar 'strcase (arx)))
(if (or (member "DOSLIB2K.ARX" ListOffLoadedArx)
(member "DOSLIB2004.ARX" ListOffLoadedArx)
)
(setq J_DO T)
)
(setq SEL_DLIN1 (sslength SEL))
(while (< k SEL_DLIN1)
(if (and (> SEL_DLIN1 50) J_DO)
(progn
(dos_getprogress
"Working..."
"Still working, please wait..."
SEL_DLIN1
)
(if J_DO
(dos_getprogress -1))
)
)
(setq ename (ssname SEL k) ;entity name
elist (entget ename) ;entity data list
etype (cdr (assoc 0 elist)) ;entity type
)
;;;;-----------------------------------------------------------------------------
(if (or
(equal etype "INSERT")
(equal etype "TEXT")
(equal etype "ATTDEF")
(equal etype "HATCH")
)
(progn
(setq xline_pt1 (cdr (assoc 10 elist)))
(if (not (equal (caddr xline_pt1) 0.0))
(progn
(setq xline_x1 (car xline_pt1))
(setq xline_y1 (cadr xline_pt1))
(setq xline_z1 0)
(modify_xline33 1)
(setq schet (1+ schet))
)
)
)
)
;;;;-----------------------------------------------------------------------------
(if (or (equal etype "CIRCLE")
(equal etype "ARC")
(equal etype "ELLIPSE")
)
(progn
(if (not (equal (caddr xline_pt1) 0.0))
(progn
(setq *acadArcObj* (vlax-ename->vla-object ename))
(if (vlax-property-available-p *acadArcObj* 'Center)
(setq StartPoint
(vlax-get-property *acadArcObj* 'Center)
)
)
(setq SP (vlax-variant-value StartPoint))
(setq SP (vlax-safearray->list SP))
(setq SP (trans SP 0 1))
(setq CP (vlax-make-safearray vlax-vbdouble '(0 . 2)))
(vlax-safearray-fill CP SP)
(vlax-safearray-put-element CP 2 0.0)
(setq CP (vlax-safearray->list CP))
(setq CP (trans CP 1 0))
(setq *CP* (vlax-make-safearray vlax-vbdouble '(0 . 2)))
(vlax-safearray-fill *CP* CP)
(if
(vlax-property-available-p *acadArcObj* 'Center T)
(progn
(vlax-put-property *acadArcObj* 'Center *CP*)
(setq schet (1+ schet))
)
)
)
)
)
)
;;;;-----------------------------------------------------------------------------
(if (equal etype "HATCH")
(if (not (equal (cdr (nth 19 elist)) 0.0))
(progn
(setq *acadObj* (vlax-ename->vla-object ename))
(if (vlax-property-available-p *acadObj* 'Elevation)
(progn
(vlax-put-property *acadObj* 'Elevation 0.0)
(setq schet (1+ schet))
)
)
)
)
)
;;;;-----------------------------------------------------------------------------
(if (equal etype "LWPOLYLINE")
(if (not (equal (cdr (assoc 38 elist)) 0.0))
(progn
(setq *acadObj* (vlax-ename->vla-object ename))
(if (vlax-property-available-p *acadObj* 'Elevation)
(progn
(vlax-put-property *acadObj* 'Elevation 0.0)
(setq schet (1+ schet))
)
)
)
)
)
;;;;-----------------------------------------------------------------------------
(if (equal etype "3DFACE")
(progn
(setq pr nil)
(foreach item elist
(if (equal (car item) 10)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(10) (trans (cdr item) 0 1)))
(setq newlist
(append
'(10)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 11)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(11) (trans (cdr item) 0 1)))
(setq newlist
(append
'(11)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 12)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(12) (trans (cdr item) 0 1)))
(setq newlist
(append
'(12)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 13)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(13) (trans (cdr item) 0 1)))
(setq newlist
(append
'(13)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
)
(if pr
(setq schet (1+ schet))
)
(modify_SPLINE 1)
(setq pr nil)
)
)
;;;;-----------------------------------------------------------------------------
(if (equal etype "SPLINE")
(progn
(setq pr nil)
(foreach item elist
(if (equal (car item) 10)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(10) (trans (cdr item) 0 1)))
(setq newlist
(append
'(10)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 11)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(11) (trans (cdr item) 0 1)))
(setq newlist
(append
'(11)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
)
(if pr
(setq schet (1+ schet))
)
(modify_SPLINE 1)
(setq pr nil)
)
)
(if (equal etype "SOLID")
(progn
(setq pr nil)
(foreach item elist
(if (equal (car item) 10)
(progn
(if (not (equal (cadddr (cdr item)) 0.0))
(progn
(setq newlist (subst 0.0 (cadddr item) item))
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 11)
(progn
(if (not (equal (cadddr (cdr item)) 0.0))
(progn
(setq newlist (subst 0.0 (cadddr item) item))
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 12)
(progn
(if (not (equal (cadddr (cdr item)) 0.0))
(progn
(setq newlist (subst 0.0 (cadddr item) item))
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 13)
(progn
(if (not (equal (cadddr (cdr item)) 0.0))
(progn
(setq newlist (subst 0.0 (cadddr item) item))
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
)
(if pr
(setq schet (1+ schet))
)
(modify_SPLINE 1)
(setq pr nil)
)
)
;;;;-----------------------------------------------------------------------------
(if (or (equal etype "DIMENSION")
(equal etype "LEADER")
(equal etype "TOLERANCE")
)
(progn
(setq pr nil)
(foreach item elist
(if (equal (car item) 10)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(10) (trans (cdr item) 0 1)))
(setq newlist
(append
'(10)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 11)
(progn
(if (not (equal (cadddr (cdr item)) 0.0))
(progn
(setq newlist (subst 0.0 (cadddr item) item))
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 13)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(13) (trans (cdr item) 0 1)))
(setq newlist
(append
'(13)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 14)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(14) (trans (cdr item) 0 1)))
(setq newlist
(append
'(14)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
(if (equal (car item) 15)
(progn
(if (not (equal (cadddr (trans (cdr item) 0 1)) 0.0))
(progn
(setq item1 (append '(15) (trans (cdr item) 0 1)))
(setq newlist
(append
'(15)
(trans
(cdr (subst 0.0 (cadddr item1) item1)
)
1
0
)
)
)
(setq elist (subst newlist item elist))
(setq pr t)
)
)
)
)
)
(if pr
(setq schet (1+ schet))
)
(modify_SPLINE 1)
(setq pr nil)
)
)
;_________________________________________________________________________
(if (equal etype "LINE")
(progn
(setq xline_pt1 (trans (cdr (assoc 10 elist)) 0 1))
(setq xline_pt2 (trans (cdr (assoc 11 elist)) 0 1))
(if (or (not (equal (caddr xline_pt1) 0.0))
(not (equal (caddr xline_pt2) 0.0))
)
(progn
(setq *acadLineObj* (vlax-ename->vla-object ename))
(if
(and
(vlax-property-available-p
*acadLineObj*
'StartPoint
)
(vlax-property-available-p *acadLineObj* 'EndPoint)
)
(progn
(setq StartPoint
(vlax-get-property *acadLineObj* 'StartPoint)
)
(setq EndPoint (vlax-get-property
*acadLineObj*
'EndPoint
)
)
)
)
(setq StartPoint (vlax-variant-value StartPoint))
(setq EndPoint (vlax-variant-value EndPoint))
(setq StartPoint (vlax-safearray->list StartPoint))
(setq EndPoint (vlax-safearray->list EndPoint))
(setq StartPoint (trans StartPoint 0 1))
(setq EndPoint (trans EndPoint 0 1))
(setq SP (vlax-make-safearray vlax-vbdouble '(0 . 2)))
(setq EP (vlax-make-safearray vlax-vbdouble '(0 . 2)))
(vlax-safearray-fill SP StartPoint)
(vlax-safearray-fill EP EndPoint)
(vlax-safearray-put-element SP 2 0.0)
(vlax-safearray-put-element EP 2 0.0)
(setq SP (vlax-safearray->list SP))
(setq EP (vlax-safearray->list EP))
(setq SP (trans SP 1 0))
(setq EP (trans EP 1 0))
(setq *SP* (vlax-make-safearray vlax-vbdouble '(0 . 2)))
(setq *EP* (vlax-make-safearray vlax-vbdouble '(0 . 2)))
(vlax-safearray-fill *SP* SP)
(vlax-safearray-fill *EP* EP)
(if
(and (vlax-property-available-p
*acadLineObj*
'StartPoint
T
)
(vlax-property-available-p
*acadLineObj*
'EndPoint
T
)
)
(progn
(vlax-put-property *acadLineObj* 'StartPoint *SP*)
(vlax-put-property *acadLineObj* 'EndPoint *EP*)
(setq schet (1+ schet))
)
)
)
)
)
)
;;;;-----------------------------------------------------------------------------
(if (equal etype "MTEXT")
(progn
(setq xline_pt1 (trans (cdr (assoc 10 elist)) 0 1))
(if (not (equal (caddr xline_pt1) 0.0))
(progn
(setq xline_x1 (car xline_pt1))
(setq xline_y1 (cadr xline_pt1))
(setq xline_z1 0)
(setq schet (1+ schet))
(modify_xline1 1)
)
)
)
)
;;;;-----------------------------------------------------------------------------
(setq k (1+ k))
)
(if (and (> SEL_DLIN1 50) J_DO)
(dos_getprogress t)
)
)
)
(defun c:FLATTEN_EM_ALL_DBLCLK (*SEL*)
(DOING_FLATTEN (car *SEL*))
)
(defun c:FLATTEN_EM_ALL ()
;;; "3DFACE"!
;;; "ATTDEF"!
;;; "HATCH"
;;; "POINT"
;;; "POLYLINE"
(setq k 0)
(setq SEL_DLIN1 nil
xline_pt1 nil
xline_pt2 nil
xline_x1 nil
xline_y1 nil
xline_z1 nil
xline_x2 nil
xline_y2 nil
xline_z2 nil
SEL nil
)
(setq schet 0)
(prompt
"\nВыберите примитивы:\n"
)
(setq SEL (ssget '((-4 . "<OR")
(0 . "LINE")
(0 . "ARC")
(0 . "CIRCLE")
(0 . "ELLIPSE")
(0 . "SPLINE")
(0 . "LWPOLYLINE")
(0 . "INSERT")
(0 . "DIMENSION")
(0 . "TEXT")
(0 . "MTEXT")
(0 . "ATTDEF")
(0 . "LEADER")
(0 . "HATCH")
(0 . "TOLERANCE")
(0 . "SOLID")
(0 . "3DFACE")
(-4 . "OR>")
)
)
)
(IF SEL
(DOING_FLATTEN SEL)
)
(princ)
(cond
((and (> schet 1) (< schet 5))
(prompt (strcat "\nИзменено " (itoa schet) " примитива"))
)
((and (>= schet 5) (< schet 21))
(prompt (strcat "\nИзменено " (itoa schet) " примитивов"))
)
((> schet 20)
(cond ((and (> (rem schet 10) 1) (< (rem schet 10) 5))
(prompt (strcat "\nИзменено " (itoa schet) " примитива\n"))
)
((and (>= (rem schet 10) 5) (<= (rem schet 10) 9))
(prompt (strcat "\nИзменено " (itoa schet) " примитивов\n"))
)
((= (rem schet 10) 1)
(prompt (strcat "\nИзменено " (itoa schet) " примитив\n"))
)
((= (rem schet 10) 0)
(prompt (strcat "\nИзменено " (itoa schet) " примитивов\n"))
)
)
)
((= schet 1)
(prompt "\nИзменен 1 примитив\n")
)
((= schet 0)
(prompt "\n\nНи один примитив не изменен.\n")
;;;;;;;;;;;;;;; (if (and (equal etype "LINE") (eq SEL_DLIN1 1))
;;;;;;;;;;;;;;; (progn
;;;;;;;;;;;;;;;;;;========================================================================
;;;;;;;;;;;;;;; (setq
;;;;;;;;;;;;;;; **pt1** (trans
;;;;;;;;;;;;;;; (trans (cdr (assoc 10 elist)) ename 0)
;;;;;;;;;;;;;;; 0
;;;;;;;;;;;;;;; 1
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; (setq
;;;;;;;;;;;;;;; **pt2** (trans
;;;;;;;;;;;;;;; (trans (cdr (assoc 11 elist)) ename 0)
;;;;;;;;;;;;;;; 0
;;;;;;;;;;;;;;; 1
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; (setq pt_x_dir (trans (getvar "UCSXDIR") 0 1 1))
;;;;;;;;;;;;;;;;;;=========================================================================
;;;;;;;;;;;;;;; (setq j 0
;;;;;;;;;;;;;;; UCS nil
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; (vlxx-ActiveUcs)
;;;;;;;;;;;;;;; (setq **JUActiveUCS** *vlxx-activeucs*)
;;;;;;;;;;;;;;;;;;=========================================================================
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; (setq ang_of_x_dir
;;;;;;;;;;;;;;; (angle '(0.0 0.0 0.0)
;;;;;;;;;;;;;;; pt_x_dir
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; (setq **AN**
;;;;;;;;;;;;;;; (- (angle **pt1** **pt2**)
;;;;;;;;;;;;;;; ang_of_x_dir
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; (if (>= **AN** pi)
;;;;;;;;;;;;;;; (setq **AN** (- **AN** pi))
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; (setq VX (list (cos **AN**) (sin **AN**) 0.0)
;;;;;;;;;;;;;;; VY (list (* -1.0 (sin **AN**)) (cos **AN**) 0.0)
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; (setq VX (trans VX 1 0)
;;;;;;;;;;;;;;; VY (trans VY 1 0)
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; (setq VECTORx (vlax-make-safearray vlax-vbdouble '(0 . 2)))
;;;;;;;;;;;;;;; (setq VECTORy (vlax-make-safearray vlax-vbdouble '(0 . 2)))
;;;;;;;;;;;;;;; (vlax-safearray-fill VECTORx VX)
;;;;;;;;;;;;;;; (vlax-safearray-fill VECTORy VY)
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; (setq VarVECTORx (vlax-make-variant VECTORx))
;;;;;;;;;;;;;;; (setq VarVECTORy (vlax-make-variant VECTORy))
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; (vla-put-XVector **JUActiveUCS** VarVECTORx)
;;;;;;;;;;;;;;; (vla-put-YVector **JUActiveUCS** VarVECTORy)
;;;;;;;;;;;;;;; (vla-put-ActiveUCS *JUActiveDoc* **JUActiveUCS**)
;;;;;;;;;;;;;;; (vlax-release-object **JUActiveUCS**)
;;;;;;;;;;;;;;; (princ)
;;;;;;;;;;;;;;;;;;=================================================================================
;;;;;;;;;;;;;;; (prompt "\nОси координат совмещены с объектом.\n")
;;;;;;;;;;;;;;; )
;;;;;;;;;;;;;;; )
)
)
(princ)
)
(defun modify_xline1 (flag)
(setq xline_pt1 (list xline_x1 xline_y1 xline_z1))
(setq elist (subst (cons 10 (trans xline_pt1 1 0))
(assoc 10 elist)
elist
)
)
(if (= 1 flag)
(entmod elist)
)
(princ)
)
(defun modify_xline2 (flag)
(setq xline_pt2 (list xline_x2 xline_y2 xline_z2))
(setq elist (subst (cons 11 (trans xline_pt2 1 0))
(assoc 11 elist)
elist
)
)
(if (= 1 flag)
(entmod elist)
)
(princ)
)
(defun modify_xline3 (flag)
(setq xline_pt3 (list xline_x3 xline_y3 xline_z3))
(setq elist (subst (cons 12 (trans xline_pt3 1 0))
(assoc 12 elist)
elist
)
)
(if (= 1 flag)
(entmod elist)
)
(princ)
)
(defun modify_xline4 (flag)
(setq xline_pt4 (list xline_x4 xline_y4 xline_z4))
(setq elist (subst (cons 13 (trans xline_pt4 1 0))
(assoc 13 elist)
elist
)
)
(if (= 1 flag)
(entmod elist)
)
(princ)
)
;______________________________________________________________
(defun modify_xline33 (flag)
(setq xline_pt1 (list xline_x1 xline_y1 xline_z1))
(setq elist (subst (cons 10 xline_pt1)
(assoc 10 elist)
elist
)
)
(if (= 1 flag)
(entmod elist)
)
(princ)
)
;______________________________________________________________
(defun modify_SPLINE (flag)
(if (= 1 flag)
(entmod elist)
)
(princ)
)
> Дмитрий
Не работает. Линии, блоки и текст, по Z имеют значение ± 0. Запускал программу командой FLATTEN_EM_ALL. AcadMAP 2004.
Страницы 1
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Форумы CADUser → Приемы работы → Импорт и экспорт данных → Как убрать высоту линий
Форум работает на PunBB, при поддержке Informer Technologies, Inc