乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 45|回复: 8

[综合讨论] 非零坐标Z

[复制链接]

3

主题

8

帖子

5

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-8 10:59:37 | 显示全部楼层 |阅读模式
我经常收到带有非零坐标Z的线或物体的2D图纸。这很烦人。我不能使用延伸或垂直。。。因为他们不在同一个平面上。
 
如何将所有物件的坐标Z重置为零?
 
请帮忙!
回复

使用道具 举报

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 2022-7-8 11:11:57 | 显示全部楼层
尝试使用快速工具展平命令。
回复

使用道具 举报

3

主题

8

帖子

5

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-8 11:19:59 | 显示全部楼层
非常感谢。
 
该死的。WTF与技术人员。
我的电脑上没有express tools的cad:cry:
回复

使用道具 举报

27

主题

113

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
132
发表于 2022-7-8 11:23:32 | 显示全部楼层
也许这个口齿不清也会这样做
 
  1. ;;; FLATTEN.LSP version 2k.01, 25-Jun-1999
  2. ;;;
  3. ;;; FLATTEN sets the Z-coordinates of these types of objects to 0
  4. ;;; in the World Coordinate System:
  5. ;;; "3DFACE" "ARC" "ATTDEF" "CIRCLE" "DIMENSION"
  6. ;;; "ELLIPSE" "HATCH" "INSERT" "LINE" "LWPOLYLINE"
  7. ;;; "MTEXT" "POINT" "POLYLINE" "SOLID" "TEXT"
  8. ;;;
  9. ;;;-----------------------------------------------------------------------
  10. ;;; copyright 1990-1999 by Mark Middlebrook
  11. ;;; Daedalus Consulting
  12. ;;; e-mail: markmiddlebrook@compuserve.com
  13. ;;;
  14. ;;; Thanks to Vladimir Livshiz for improvements in polyline handling
  15. ;;; and the addition of several other object types.
  16. ;;;
  17. ;;; You are free to distribute FLATTEN.LSP to others so long as you do not
  18. ;;; charge for it.
  19. ;;;
  20. ;;;-----------------------------------------------------------------------
  21. ;;; Revision history
  22. ;;; v. 2k.0 25-May-1999 First release for AutoCAD 2000.
  23. ;;; v. 2k.01 25-Jun-1999 Fixed two globalization bugs ("_World" & "_X")
  24. ;;; and revised error handler.
  25. ;;;-----------------------------------------------------------------------
  26. ;;;*Why Use FLATTEN?
  27. ;;;
  28. ;;; FLATTENing is useful in at least two situations:
  29. ;;; 1) You receive a DXF file created by another CAD program and discover
  30. ;;; that all the Z coordinates contain small round-off errors. These
  31. ;;; round-off errors can prevent you from object snapping to
  32. ;;; intersections and make your life difficult in other ways as well.
  33. ;;; 2) In a supposedly 2D drawing, you accidentally create one object with
  34. ;;; a Z elevation and end up with a drawing containing objects partly
  35. ;;; in and partly outside the Z=0 X-Y plane. As with the round-off
  36. ;;; problem, this situation can make object snaps and other procedures
  37. ;;; difficult.
  38. ;;;
  39. ;;; Warning: FLATTEN is not for flattening the custom objects created by
  40. ;;; applications such as Autodesk's Architectural Desktop. ADT and similar
  41. ;;; programs create "application-defined objects" that only the
  42. ;;; application really knows what to do with. FLATTEN has no idea how
  43. ;;; to handle application-defined objects, so it leaves them alone.
  44. ;;;
  45. ;;;-----------------------------------------------------------------------
  46. ;;;*How to Use FLATTEN
  47. ;;;
  48. ;;; This version of FLATTEN works with AutoCAD R12 through 2000.
  49. ;;;
  50. ;;; To run FLATTEN, load it using AutoCAD's APPLOAD command, or type:
  51. ;;; (load "FLATTEN")
  52. ;;; at the AutoCAD command prompt. Once you've loaded FLATTEN.LSP, type:
  53. ;;; FLATTEN
  54. ;;; to run it. FLATTEN will tell you what it's about to do and ask you
  55. ;;; to confirm that you really want to flatten objects in the current
  56. ;;; drawing. If you choose to proceed, FLATTEN prompts you to select objects
  57. ;;; to be flattened (press ENTER to flatten all objects in the drawing).
  58. ;;; After you've selected objects and pressed ENTER, FLATTEN goes to work.
  59. ;;; It reports the number of objects it flattens and the number left
  60. ;;; unflattenened (because they were objects not recognized by FLATTEN; see
  61. ;;; the list of supported objects above).
  62. ;;;
  63. ;;; If you don't like the results, just type U to undo FLATTEN's work.
  64. ;;;
  65. ;;;-----------------------------------------------------------------------
  66. ;;;*Known limitations
  67. ;;; 1) FLATTEN doesn't support all of AutoCAD's object types. See above
  68. ;;; for a list of the object types that it does work on.
  69. ;;; 2) FLATTEN doesn't flatten objects nested inside of blocks.
  70. ;;; (You can explode blocks before flattening. Alternatively, you can
  71. ;;; WBLOCK block definitions to separate DWG files, run FLATTEN in
  72. ;;; each of them, and then use INSERT in the parent drawing to update
  73. ;;; the block definitions. Neither of these methods will flatten
  74. ;;; existing attributes, though.
  75. ;;; 3) FLATTEN flattens objects onto the Z=0 X-Y plane in AutoCAD's
  76. ;;; World Coordinate System (WCS). It doesn't currently support
  77. ;;; flattening onto other UCS planes.
  78. ;;;
  79. ;;;=======================================================================
  80. (defun C:FLATTEND (/ tmpucs olderr oldcmd zeroz ss1 ss1len
  81. i numchg numnot numno0 ssno0 ename elist
  82. etype yorn vrt crz
  83. )
  84. (setq tmpucs "$FLATTEN-TEMP$") ;temporary UCS
  85. ;;Error handler
  86. (setq olderr *error*)
  87. (defun *error* (msg)
  88. (if (or
  89. (= msg "Function cancelled")
  90. (= msg "quit / exit abort")
  91. )
  92. ;;if user cancelled or program aborted, exit quietly
  93. (princ)
  94. ;;otherwise report error message
  95. (princ (strcat "\nError: " msg))
  96. )
  97. (setq *error* olderr)
  98. (if (tblsearch "UCS" tmpucs)
  99. (command "._UCS" "_Restore" tmpucs "._UCS" "_Delete" tmpucs)
  100. )
  101. (command "._UNDO" "_End")
  102. (setvar "CMDECHO" oldcmd)
  103. (princ)
  104. )
  105. ;;Function to change Z coordinate to 0
  106. (defun zeroz (key zelist / oplist nplist)
  107. (setq oplist (assoc key zelist)
  108. nplist (reverse (append '(0.0) (cdr (reverse oplist))))
  109. zelist (subst nplist oplist zelist)
  110. )
  111. (entmod zelist)
  112. )
  113. ;;Setup
  114. (setq oldcmd (getvar "CMDECHO"))
  115. (setvar "CMDECHO" 0)
  116. (command "._UNDO" "_Group")
  117. (command "._UCS" "_Delete" tmpucs "._UCS" "_Save" tmpucs "._UCS" "_World")
  118. ;set World UCS
  119. ;;Get input
  120. (prompt
  121. (strcat
  122. "\nFLATTEN sets the Z coordinates of most objects to zero."
  123. )
  124. )
  125. (initget "Yes No")
  126. (setq yorn (getkword "\nDo you want to continue Y>: "))
  127. (cond ((/= yorn "No")
  128. (graphscr)
  129. (prompt "\nChoose objects to FLATTEN ")
  130. (prompt
  131. "[press return to select all objects in the drawing]"
  132. )
  133. (setq ss1 (ssget))
  134. (if (null ss1) ;if enter...
  135. (setq ss1 (ssget "_X")) ;select all entities in database
  136. )
  137.  
  138. ;;*initialize variables
  139. (setq ss1len (sslength ss1) ;length of selection set
  140. i 0 ;loop counter
  141. numchg 0 ;number changed counter
  142. numnot 0 ;number not changed counter
  143. numno0 0 ;number not changed and Z /= 0 counter
  144. ssno0 (ssadd) ;selection set of unchanged entities
  145. ) ;setq
  146. ;;*do the work
  147. (prompt "\nWorking.")
  148. (while ( i ss1len) ;while more members in the SS
  149. (if (= 0 (rem i 10))
  150. (prompt ".")
  151. )
  152. (setq ename (ssname ss1 i) ;entity name
  153. elist (entget ename) ;entity data list
  154. etype (cdr (assoc 0 elist)) ;entity type
  155. )
  156. ;;*Keep track of entities not flattened
  157. (if (not (member etype
  158. '("3DFACE" "ARC" "ATTDEF"
  159. "CIRCLE" "DIMENSION" "ELLIPSE"
  160. "HATCH" "INSERT" "LINE"
  161. "LWPOLYLINE" "MTEXT" "POINT"
  162. "POLYLINE" "SOLID" "TEXT"
  163. )
  164. )
  165. )
  166. (progn ;leave others alone
  167. (setq numnot (1+ numnot))
  168. (if (/= 0.0 (car (reverse (assoc 10 elist))))
  169. (progn ;add it to special list if Z /= 0
  170. (setq numno0 (1+ numno0))
  171. (ssadd ename ssno0)
  172. )
  173. )
  174. )
  175. )
  176. ;;Change group 10 Z coordinate to 0 for listed entity types.
  177. (if (member etype
  178. '("3DFACE" "ARC" "ATTDEF" "CIRCLE"
  179. "DIMENSION" "ELLIPSE" "HATCH" "INSERT"
  180. "LINE" "MTEXT" "POINT" "POLYLINE"
  181. "SOLID" "TEXT"
  182. )
  183. )
  184. (setq elist (zeroz 10 elist) ;change entities in list above
  185. numchg (1+ numchg)
  186. )
  187. )
  188. ;;Change group 11 Z coordinate to 0 for listed entity types.
  189. (if (member etype
  190. '("3DFACE" "ATTDEF" "DIMENSION" "LINE" "TEXT" "SOLID")
  191. )
  192. (setq elist (zeroz 11 elist))
  193. )
  194. ;;Change groups 12 and 13 Z coordinate to 0 for SOLIDs and 3DFACEs.
  195. (if (member etype '("3DFACE" "SOLID"))
  196. (progn
  197. (setq elist (zeroz 12 elist))
  198. (setq elist (zeroz 13 elist))
  199. )
  200. )
  201. ;;Change groups 13, 14, 15, and 16
  202. ;;Z coordinate to 0 for DIMENSIONs.
  203. (if (member etype '("DIMENSION"))
  204. (progn
  205. (setq elist (zeroz 13 elist))
  206. (setq elist (zeroz 14 elist))
  207. (setq elist (zeroz 15 elist))
  208. (setq elist (zeroz 16 elist))
  209. )
  210. )
  211. ;;Change each polyline vertex Z coordinate to 0.
  212. ;;Code provided by Vladimir Livshiz, 09-Oct-1998
  213. (if (= etype "POLYLINE")
  214. (progn
  215. (setq vrt ename)
  216. (while (not (equal (cdr (assoc 0 (entget vrt))) "SEQEND"))
  217. (setq elist (entget (entnext vrt)))
  218. (setq crz (cadddr (assoc 10 elist)))
  219. (if (/= crz 0)
  220. (progn
  221. (zeroz 10 elist)
  222. (entupd ename)
  223. )
  224. )
  225. (setq vrt (cdr (assoc -1 elist)))
  226. )
  227. )
  228. )
  229. ;;Special handling for LWPOLYLINEs
  230. (if (member etype '("LWPOLYLINE"))
  231. (progn
  232. (setq elist (subst (cons 38 0.0) (assoc 38 elist) elist)
  233. numchg (1+ numchg)
  234. )
  235. (entmod elist)
  236. )
  237. )
  238. (setq i (1+ i)) ;next entity
  239. )
  240. (prompt " Done.")
  241. ;;Print results
  242. (prompt (strcat "\n" (itoa numchg) " object(s) flattened."))
  243. (prompt
  244. (strcat "\n" (itoa numnot) " object(s) not flattened.")
  245. )
  246. ;;If there any entities in ssno0, show them
  247. (if (/= 0 numno0)
  248. (progn
  249. (prompt (strcat " ["
  250. (itoa numno0)
  251. " with non-zero base points]"
  252. )
  253. )
  254. (getstring
  255. "\nPress enter to see non-zero unchanged objects... "
  256. )
  257. (command "._SELECT" ssno0)
  258. (getstring "\nPress enter to unhighlight them... ")
  259. (command "")
  260. )
  261. )
  262. )
  263. )
  264. (command "._UCS" "_Restore" tmpucs "._UCS" "_Delete" tmpucs)
  265. (command "._UNDO" "_End")
  266. (setvar "CMDECHO" oldcmd)
  267. (setq *error* olderr)
  268. (princ)
  269. )
  270. (prompt
  271. "\nFLATTEN version 2k.01 loaded. Type FLATTEN to run it."
  272. )
  273. (princ)
  274. ;;;eof
回复

使用道具 举报

0

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-8 11:34:58 | 显示全部楼层
你好
我也有同样的问题,但我仍然不明白,我怎样才能展平图形中的所有多段线?
我没有“扁平”comand
非常感谢。
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-8 11:40:12 | 显示全部楼层
这条线索可能很有趣。。。
http://www.cadtutor.net/forum/showthread.php?t=16434&highlight=flatten
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-8 11:51:50 | 显示全部楼层
马里耶:要么从安装DVD上下载Express Tools,要么使用FLATTEN。LSP例程,或上面链接中发布的方法。
 
有关使用AutoLISP例程的说明,请参阅“我相信自定义”下的AutoCAD常见问题部分。
回复

使用道具 举报

13

主题

126

帖子

114

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
65
发表于 2022-7-8 11:57:33 | 显示全部楼层
在大多数情况下,对我有效的一件事就是简单地选择有问题的区域,单击“属性”,并将“开始Z”和“结束Z”几何体值设置为0。
 
SMUSH公司
 
现在它是平的。
 
格伦
回复

使用道具 举报

0

主题

172

帖子

173

银币

限制会员

铜币
-1
发表于 2022-7-8 12:01:37 | 显示全部楼层
如果没有express工具(或者可能正在使用LT so cant run lisps),可以将以下字符串放到工具栏按钮上,只需单击一下即可展平图形
 
^C^C_选择;全部_移动p0,0,0;0,0,1e99_移动_p0,0,0;0,0,-1e99^M
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 16:28 , Processed in 0.603801 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表