乐筑天下

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

[编程交流] labelling Easting & Northing c

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 06:46:48 | 显示全部楼层
This will return points in WCS:
  1. (defun c:pt ( / p )   (while (setq p (getpoint "\nPick point to label: "))       (entmake           (list              '(000 . "MTEXT")              '(100 . "AcDbEntity")              '(100 . "AcDbMText")               (cons 011 (getvar 'ucsxdir))               (cons 010 (setq p (trans p 1 0)))               (cons 001 (apply 'strcat (mapcar 'strcat '("E " "\\PN " "\\PZ ") (mapcar 'rtos p))))               (cons 210 (trans '(0.0 0.0 1.0) 1 0 t))           )       )   )   (princ))
This will returns points in UCS:
  1. (defun c:pt ( / p )   (while (setq p (getpoint "\nPick point to label: "))       (entmake           (list              '(000 . "MTEXT")              '(100 . "AcDbEntity")              '(100 . "AcDbMText")               (cons 011 (getvar 'ucsxdir))               (cons 010 (trans p 1 0))               (cons 001 (apply 'strcat (mapcar 'strcat '("E " "\\PN " "\\PZ ") (mapcar 'rtos p))))               (cons 210 (trans '(0.0 0.0 1.0) 1 0 t))           )       )   )   (princ))
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 06:48:22 | 显示全部楼层
Lee , I can't see the difference between the two routines , but i think the second one - the trans function must be 0 1 and not 1 0 , Am I right ?
回复

使用道具 举报

2

主题

10

帖子

8

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 06:51:51 | 显示全部楼层
well.......... i created a new UCS, then i entered a line from origin (0,0) to point(4400', 3000') ,,, then i moved the whole layout from left bottom corner (4400, 3000) to that point
amd now it gives the correct coordinates,....BUT ALL IN INCHES,.... again a problem,....
 
071255lpqyyyq4yqyeca6m.jpg
071257vnp4vtuffzpt4pkn.jpg
回复

使用道具 举报

2

主题

10

帖子

8

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 06:55:35 | 显示全部楼层
58000.53" / 12 = 4833.37' ,...... it means its giving correct coordinates,.... but i need them in feet,
plz help
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 06:59:07 | 显示全部楼层
 
No, look closer.
回复

使用道具 举报

1

主题

80

帖子

79

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:00:16 | 显示全部楼层
I was unaware you were intending to alter the origin, as it was not specified in your original request. I will look into writing something if I have some free time on my vacation. If not, there are many knowledgeable members who can assist you.
 
Edit: disregard, I was too slow posting.
回复

使用道具 举报

2

主题

10

帖子

8

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:04:53 | 显示全部楼层
im thankful to you guys,...
 
my current problem is y the coordinates are in INCHES,.... ? THEY MUST BE IN FEET,.........
KINDLY GIVE SOLUTION,.....
 
HERE IS THE CODE IM USING:
 
  1. (defun Styles()         ;create text Style            (if (not (tblsearch "style" "Gen-Text")) (command "-style" "Gen-Text" "Arial.ttf" "A""yes" "No" 2.5 "1" 0 "n" "n"))      ;create dimension style      (if (not (tblsearch "DImstyle" "Dim Arrow Ann"))       (progn          (command "dim" "style" "Gen-Text"           "DIMADEC"     0           "DIMALT"      0           "DIMALTD"     2           "DIMALTF"     1.000           "DIMALTRND"   0.0000           "DIMALTTD"    2           "DIMALTTZ"    0           "DIMALTU"     2           "DIMALTZ"     0           "DIMASZ"      3           "DIMATFIT"    3           "DIMAUNIT"    0           "DIMAZIN"     0           "DIMBLK"      ""           "DIMBLK1"     ""           "DIMBLK2"     ""           "DIMLDRBLK"   ""           "DIMCEN"      0           "DIMCLRD"     7           "DIMCLRE"     7           "DIMCLRT"     7           "DIMDEC"      0           "DIMDLE"      0.0000           "DIMDLI"      1.0000           "DIMEXE"      1.5000           "DIMEXO"      1.5000           "DIMFRAC"     0           "DIMGAP"      1.0000           "DIMJUST"     0           "DIMLFAC"     1000.0000           "DIMLIM"      0           "DIMLUNIT"    2           "DIMLWD"      0           "DIMLWE"      0            "DIMRND"      0.0000           "DIMSAH"      0           "DIMSCALE"    1.0000           "DIMSD1"      0           "DIMSD2"      0           "DIMSE1"      0           "DIMSE2"      0           "DIMSOXD"     0           "DIMTAD"      1                "DIMTDEC"     0           "DIMTIH"      0           "DIMTIX"      0           "DIMTM"       0.0000           "DIMTMOVE"    0           "DIMTOFL"     0           "DIMTOH"      0           "DIMTSZ"      0.0000           "DIMTVP"      0.0000           "DIMTXSTY"    "Gen-Text"           "DIMTXT"      2.5000           "DIMZIN"      0           "DIMFIT"      5 /e)                          (command "dimstyle" "An" "y" "Dim Arrow Ann" "S" "")       ) ;progn     ) ;if     ) ;defun;;-------------------------------------------* error *-----------------------------------------------------(defun trap1 (errmsg)          (setq *error* temperr)          (setvar "clayer" clay)          (prompt "\n © Bijoy manoharan 2010 www.cadlispandtips.com")(princ)) ;defun;;-------------------------------------------Set Datum-----------------------------------------------------(defun C:dat (/ num op sta pga stb pgb)             (command "cmdecho"0)       (command "ucs" "w")          ;;; input station              (if (not nf-ns) (setq nf-ns 0.000))    ; default number       (setq NUM (getreal (strcat "\nEnter Eastward datum : ")))         (if (not num) (setq num nf-ns) (setq nf-ns num))  ;;; input pgl       (if (not sf-ss) (setq sf-ss 0.000))    ; default number       (setq SUM (getreal (strcat "\nEnter Northward datum : ")))        (if (not sum) (setq sum sf-ss) (setq sf-ss sum))     ;;; set orign point       (setq op (getpoint "\nPick datum orgin point: "))         (setq sta (car op))       (setq pga (cadr op))          (setq stb (- sta num))              (setq pgb (- pga sum))           (command "ucs" "m" (list stb pgb 0))       (prompt "\nOrigin moved to new loaction - Enter Command EN to place Text")               (princ)) ;defun       ;;-------------------------------------------Place Text----------------------------------------------------(defun C:EN (/ enp1 ex ey dy ptl e TextObj vlText)        (command "cmdecho"0)        (setq clay (getvar "clayer"))        (setq temperr *error*)        (setq *error* trap1)                              (if (not (tblsearch "layer" "Text Coordinate")) (command  "-LAYER" "N" "Text Coordinate" "C" "7" "Text Coordinate" "LT"  "Continuous" "Text Coordinate""LW" "0.15" "Text Coordinate" ""))        (Styles)        (command "CLAYER" "Text Coordinate")        (command "-DIMSTYLE" "r" "Dim Arrow Ann")                (setq ptlist nil) ; for while command (while         (progn                  (setq enp1 (getpoint "\nPick Coordinate point: "))         (setq ex (car enp1))  ;x coord         (setq ey (cadr enp1)) ;y coord         (setq enx (rtos ex 2 3))         (setq eny (rtos ey 2 3))                      (setq ptl (getpoint "\nPick text location: "))                (SETVAR 'DIMTAD 0) ; Justification centered         (SETVAR 'DIMLDRBLK "_ORIGIN") ;; leader arrow       (command "leader" enp1 ptl "" (strcat "E " enx) (strcat "N " eny) "")       (setq TextObj (entlast))            (vl-load-com)       (setq vlText (vlax-ename->vla-object TextObj))            (vlax-put-property vlText 'backgroundfill :vlax-true)  ; background mask               (SETVAR 'DIMTAD 1 ) ; Justification above        (setvar "DIMLDRBLK" ".") ;;leader arrow        (setq ptlist (append ptlist (list pt))) ; to stop while command      ) ;progn    ) ;while    (princ)) ; defun             ;;----------------------------------------Back to UCS World-----------------------------------------------------(defun C:uw ()       (command "ucs" "w")       (prompt "\nUCS Origin is set to World") (princ)) ; defun(princ "\nEasting & Northing Lisp | © Bijoy manoharan 2010 | [url="http://www.cadlispandtips.com"]www.cadlispandtips.com[/url] |")(princ "\nLisp Commands:DAT(to set Datum point),UW(Ucs World),EN(to Coordinate text)")(princ);;----------------------------------------------End-----------------------------------------------------
回复

使用道具 举报

8

主题

1133

帖子

1164

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:08:51 | 显示全部楼层
The short answer is that your new drawing is not in the correct drawing units, and should probably be scaled to suit.
 
If you want to adjust your existing lisp, then look at the "rtos" function which needs the correct mode to do what you want. But if you alter the lisp for this drawing, then will all the rest of your drawings misbehave?
 
P.S. you should probably edit your previous post to enclose the lisp code in code quotes otherwise the Mods will be getting at you
回复

使用道具 举报

4

主题

2143

帖子

2197

银币

限制会员

铜币
-24
发表于 2022-7-6 07:11:33 | 显示全部楼层
Please read the Code posting guidelines and edit your post to include the Code in Code Tags.
回复

使用道具 举报

1

主题

19

帖子

18

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:15:01 | 显示全部楼层
Call me old school, but as a civil engineer I still work "unitless".  I would have approached a drawing like this two fold.  Assuming I received it from a client (presumably an architect), I would have started a new base civil drawing in decimal feet and XREF'd the drawing in at 1/12 and moved and rotated the XREF to a new origin (if necessary).
 
I also do this with my many of my own drawings (sans the 1/12 scaling) since we start survey projects in an assumed coordinate system; ie N=10,0000 E=5,000 Elev=100 and then post process the local control onto State Plane Coordinates and reference onto our GIS mapping.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:28 , Processed in 1.251959 second(s), 72 queries .

© 2020-2025 乐筑天下

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