乐筑天下

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

[编程交流] Multiple-choice questions

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 06:42:32 | 显示全部楼层
Please study the following example carefully:
  1. ([color=BLUE]defun[/color] c:essai ( [color=BLUE]/[/color] col enx pt1 pt2 )   [color=GREEN];; Define function, declare local variable symbols.[/color]   [color=GREEN];; To understand why variable declaration is important,[/color]   [color=GREEN];; see [url]http://lee-mac.com/localising.html[/url][/color]   ([color=BLUE]if[/color] [color=GREEN];; If the following expression returns a non-nil value[/color]       ([color=BLUE]and[/color]           [color=GREEN];; All of the supplied expressions must return a non-nil[/color]           [color=GREEN];; value for AND to return T. AND will cease evaluating[/color]           [color=GREEN];; expressions when an expression returns nil, or when[/color]           [color=GREEN];; all expressions have been evaluated.[/color]                      ([color=BLUE]setq[/color] pt1 ([color=BLUE]getpoint[/color] [color=MAROON]"\n1st Point: "[/color]))           [color=GREEN];; Prompt user for 1st point[/color]           [color=GREEN];; e.g. pt1 = (123.0 456.0 0.0)[/color]           ([color=BLUE]setq[/color] pt2 ([color=BLUE]getpoint[/color] [color=MAROON]"\n2nd Point: "[/color] pt1))           [color=GREEN];; Prompt user for 2nd point, rubber-band to 1st point[/color]           [color=GREEN];; e.g. pt2 = (567.0 789.0 0.0)[/color]                  ) [color=GREEN];; end AND[/color]       ([color=BLUE]progn[/color]           [color=GREEN];; Evaluate the following expressions and return the result[/color]           [color=GREEN];; of the last expression evaluated. PROGN is used as a[/color]           [color=GREEN];; wrapper function so that we can pass multiple expressions[/color]           [color=GREEN];; to the IF function as a single argument constituting the[/color]           [color=GREEN];; 'then' parameter.[/color]                      ([color=BLUE]command[/color] [color=MAROON]"_.pline"[/color] [color=MAROON]"_non"[/color] pt1 [color=MAROON]"_non"[/color] pt2 [color=MAROON]""[/color])           [color=GREEN];; Invoke the PLINE command[/color]           [color=GREEN];; Command prefix meanings:[/color]           [color=GREEN];; "_"   = use the English version of the command/keyword[/color]           [color=GREEN];; "."   = use a non-redefined version of the command[/color]           [color=GREEN];; "non" = Object Snap modifier equal to "None" to ignore Object Snap for the next point[/color]                      ([color=BLUE]setq[/color] enx ([color=BLUE]entget[/color] ([color=BLUE]entlast[/color])))           [color=GREEN];; Retrieve the DXF data of the last entity added to the drawing database[/color]           [color=GREEN];; More error trapping is potentially required here to ensure that the[/color]           [color=GREEN];; LWPolyline was created successfully and is indeed the last entity[/color]           [color=GREEN];; added to the drawing database, but I shall omit this to retain the[/color]           [color=GREEN];; simplicity of this example.[/color]           [color=GREEN];; e.g. enx = ((0 . "LWPOLYLINE") (5 . "ABC") (90 . 2) (70 . 0) ... )[/color]                      ([color=BLUE]if[/color] ([color=BLUE]setq[/color] col ([color=BLUE]assoc[/color] 62 enx))               [color=GREEN];; If the DXF data contains DXF group 62, assign this pair to the local variable 'col'[/color]               [color=GREEN];; Entities with colour set to ByLayer will not contain a[/color][color=GREEN] DXF group 62 pair.[/color]               [color=GREEN];; e.g. col = (62 . 3) or col = nil[/color]                              ([color=BLUE]entmod[/color] ([color=BLUE]subst[/color] '(62 . 2) col enx))               [color=GREEN];; If DXF group 62 is present, i.e. 'col' is non-nil,[/color]               [color=GREEN];; substitute the DXF group 62 pair for a new pair within the[/color]               [color=GREEN];; DXF data, and use ENTMOD to update the DXF data in the drawing database.[/color]                              ([color=BLUE]entmod[/color] ([color=BLUE]append[/color] enx '((62 . 2))))               [color=GREEN];; Else, the entity colour was set to ByLayer and 'col' = nil[/color]               [color=GREEN];; so append a new DXF group 62 pair to the DXF data and use[/color]               [color=GREEN];; ENTMOD to update the DXF data for the entity in the drawing database.[/color]                          ) [color=GREEN];; end IF[/color]                  ) [color=GREEN];; end PROGN[/color]          ) [color=GREEN];; end IF[/color]      ([color=BLUE]princ[/color]) [color=GREEN];; Supress the return of the last evaluated expression[/color]   ) [color=GREEN];; end DEFUN[/color]
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 06:46:28 | 显示全部楼层
Thank You Lee Mac !!!  really really good explained, nothing to tell.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 06:49:50 | 显示全部楼层
Excellent, I'm glad my explanations were comprehensible.
You're very welcome Mathieu.
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 06:52:48 | 显示全部楼层
Hello everybody, i come back in this post because , i would like to have a possibility to get back every name's block "assistant" in my drawing to erase it. How i can to do? And if i'ts possible to have some explanation of every details about this function "ssget" because i don't understand for example : "_+.:E:S" there it's that i can find in a french post but i don't understand. Thank you
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 06:56:21 | 显示全部楼层
Hello , it's fine i have just find the code to get back my "assistant" blocks. It was to erase it. you can see by the  join picture "assistant", my blocks on continuation of the polylign but that it's just a litle help for the user choose which side he wants to have these lightings. Actually the polylign it's the  lighting network. After this part, i'm blocked to get back each litle "polylign" who represent the jonction betwen the main network and lightings when you can show in the join picture " explanations".
 
I hope you will understand because i know it's long and maybe i don't use the good word to explain me. So tell me if you are not understand something. I continue my program by steps and there i'm blocked to get back my entities
 
Below the actually code who permit to draw the jonction betwen the main network and my lightings.
 
  1. (defun DECAL_CANDE (/ rep n pt3) ;;rappel : red: en haut ;;             blue: en bas (initget "red blue") (setq        rep (getkword   "\n which side want to put your lightings? [red/blue]  : " ) ) (setq jsBlock (ssget "_A" (list '(0 . "INSERT") '(2 . "assistant")))) (command "_erase" jsBlock "") ; there i tell at the program to erase my "assistant" blocks to draw the jonction. (if (or (eq rep "red") (eq rep "R") (eq rep "")); if the  answer is red we draw on this side   (progn                                ;draw in the red side     (foreach n lst_pt ; lst_pt contain the list with each point of insert lighting blocks, (variable set in other code) (setq pt3 (polar n (+ orient (/ pi 2)) decalageCandelabre) ; "decalageCandelabre" is the distance betwen the main network and the lighting      pt4 (polar n (+ orient pi) (/ decalageCandelabre 2))      pt5 (polar n (+ orient 0) (/ decalageCandelabre 2)))(command "polylign" n pt3 "")        ; i have to get back entitie(command "polylign" n pt4 "")        ; i have to get back entitie(command "polylign" pt4 pt3 "")        ; i have to get back entitie(command "polylign" n pt5 "")        ; i have to get back entitie(command "polylign" pt5 pt3 "")        ; i have to get back entitie     (command "inserer" ; this command it's for insert the lightings blocks but it doesn't work for the moment       "C:/pgn_mat/Blocs/candelabre3.dwg"       n       1       1       (* (/ orient pi) 180.0)       ""     )   )   (progn     (foreach n lst_pt(setq pt6 (polar n (+ orient (- (/ pi 2))) decalageCandelabre)      pt7 (polar n (+ orient 0) (/ decalageCandelabre 2))      pt8 (polar n (+ orient pi ) (/ decalageCandelabre 2)))(command "polylign" n pt6 "");; i have to get back entitie(command "polylign" n pt7 "");; i have to get back entitie(command "polylign" pt7 pt6 "");; i have to get back entitie(command "polylign" n pt8 "");; i have to get back entitie(command "polylign" pt8 pt6 "");; i have to get back entitie     )         (command "inserer"  ; this command it's for insert the lightings blocks but it doesn't work for the moment       "C:/pgn_mat/Blocs/candelabre3.dwg"       n       1       1       (* (/ orient pi) 180.0)       ""     )   ) ))
 
THANK YOU
 
I had prepare some pictures to show you but i don't arrive to insert it i'm sorry
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 06:59:42 | 显示全部楼层
there is another site in french where we can see the pictures of my program http://cadxp.com/topic/37941-probleme-gisement-abscisse-sur-une-droite/page__st__40
 
THANk you
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 07:01:21 | 显示全部楼层
i'm sorry but you cannot to se pictures in this website because we had to register :/
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:05:53 | 显示全部楼层
 
See the ssget reference I have attached to this post.
 
[ may require membership to view the attachment ]
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 07:08:10 | 显示全部楼层
Thank you Lee i understand now but it's strange because in the help documentation of lisp it's not write. So have you read my last post Lee. I'm blocked to get back my entities, i would like to get back it in the list variable with function (list x) ...
 
Thank you
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 07:11:16 | 显示全部楼层
Hello Every body
 
i have a problem to break my polylign
Actually i want to use this command and to break in two points my polylign
But the problem is i don't want that its the user chose two points and the entity polylign with (entsel) and (getpoint)
 
I know already my points (PT2 PT3) and my polylign name's "polyReseau"
 
So when i use the command "_break" :
  1. (command "_break" ent "1" PT3 PT4)
 
 
The command  does not recognize PT2 and PT4.
 
Someone can help me ??
 
Thank you
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:48 , Processed in 0.948157 second(s), 70 queries .

© 2020-2025 乐筑天下

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