8
) 我不太懂代码。这是哪里?如果我的“setq”是,我假设它应该去?
编辑:尝试使用它并获得此信息
我的代码很差,调试也很差。
编辑#2:
经过一点格式调整和缺少括号从上面,然后一个Defun错误,这是下面的一个“太多的参数”错误。
10
我无法通过这一部分,我正在谷歌上寻找解决方法。
[/颜色]
我知道我的代码中有很多错误。整个结构可能应该重写,但我已经说过多次了,但它被忽略了。我不知道如何编写代码和自学一些我不擅长的东西是非常困难的。当我试图从一位有10年经验的老师那里学习SQL时,我遇到了困难。
[/颜色] Matt_D,
我认为BIGAL只是给了你一些可以/应该改变的例子,而不是完整的代码,所以我不希望它在没有修改的情况下运行。
我浏览了代码并注释了一些行,只是为了让它运行,这样我就可以看到它是如何工作的,并做了一些更改和注释。(每次检查后,您都需要关闭警报窗口,但如果愿意,您可以将其注释掉。)
11 恕我直言,我用清晰的英语解释了这一点,除非英语是你的第二语言,我将再次解释。
该lisp的目的是将用户给定的点或基准与坐标尺寸基准进行比较。例如,假设正确的基准是0,0,0。通过图形编辑,图形上的坐标尺寸以某种方式从0,0,0移动。假设一个移动到1,0,1,另一个移动到1,1,0。lisp例程将扫描所有坐标尺寸,并将其基准与用户给定的基准0,0,0进行比较。将标记为1,0,1和1,1,0的两个坐标标注基准,lisp将从其点绘制一条线,表明它们不正确,同时忽略其他0,0,0的坐标标注基准。
是的,我在教室外学不好代码。我需要完成代码来学习如何构建新代码。
比加尔:
现在我要回到发布的lisp例程。我试图遵循你的代码,但我不明白为什么你取消了第一个IF语句。
我试图将IF语句从BKT转换为表示不相等,但lisp不断抛出错误。
出现了“太多的争论”。否则,lisp将在图形中的每个坐标标注上绘制线。我在试着 Matt_D,
I think BIGAL was just giving you examples of things you could/should change, not finished code, so I wouldn't expect it to run without modifications.
I went through the code and commented out some lines just to get it running so I could see how it might work, and made a couple of changes and notes.(You'll need to close out the alert window after each check, but you could comment that out if you wanted to.)
(defun c:ordinatecheck (/ origin ss obj StPt EdPt x) (setq origin (getpoint "Pick a point or type coordinate: ")) (command "-layer" "m" "DIM_WRONG" "c" "red" "DIM_WRONG" "p" "n" "s" "DIM_WRONG" "");(if T; ((10 . *) (100 . "AcDbOrdinateDimension") = !origin); (progn (nil)); (/= origin); (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) (if (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) (repeat (setq x (sslength ss)) I feel like a broken record. I'm not good with programming of any sort, so any 'suggestions' aren't going to make sense to me. I need finished code to work and pick through to change and have it do what I wish to.
And as for the code you presented, it's definitely a start in the right direction. I just need to modify it to only draw lines on the ordinate dimensions whose ordinate point doesn't like up with the user input origin. So I thank you for helping there. I'll be looking through my coding and analyzing yours to figure the difference out and understand it.once I get it drawing lines on only what I want it to draw lines on, I'll be posting the code back up. I think you'll find that, at CADTutor, most times you won't get folks to post finished code right away. The idea is to attempt to help with the learning process.
That being said, does the code now draw a line to the "shifted" dimensions? This is close and should guide you, still a bit confused about which points to compare
(command "-layer""m" "DIM_WRONG" "c" "red" "DIM_WRONG" "s" "DIM_WRONG" "")(setq origin (getpoint "Pick a point or type coordinate: "))(if (/= (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) NIL)(progn(repeat (setq x (sslength ss)) (setq obj (entget (ssname ss (setq x (- x 1)))))(setq StPt (cdr (assoc 10 obj)))(setq EdPt (cdr (assoc 11 obj)))(if (= origin stpt)(progn(entmake (list (CONS 0"cIRCLE") (cons 10 EDPt) (cons 40 10))) ; entmake) ;PROGN) ; IF) ; PROGN) ; IF(PRINC) With all due respect, I explained this in clear English, unless English is your second language, of which I shall explain it again.
The purpose of this lisp is to compare a User given point or datum to the ordinate dimension datum. So for instance, lets say that the correct datum is 0,0,0.And through drawing editing, the ordinate dimensions that are on the drawing somehow get moved from 0,0,0.Say one gets moved to 1,0,1 and another is moved to 1,1,0.The lisp routine will scan all the ordinate dimensions and compare their datums to the user given datum of 0,0,0.Those two ordinate dimension datum that are 1,0,1 and 1,1,0 will be flagged and the lisp will draw a line from their points, indicating that they are incorrect while ignoring other ordinate dimension datums that are 0,0,0.
Yeah, I don't learn code well outside a classroom. I'm one who needs finished code to learn how to construct new code.
Bigal:
Now I'm going to get back to the lisp routine that was posted. I tried to follow your code, but I don't understand why you nullified the first IF statement.
I've tried to switch the IF statement from BKT to saying NOT EQUAL, but the lisp keeps throwing an error.
(defun c:ordinatecheck2 (/ origin ss obj StPt EdPt x) (setq origin (getpoint "Pick a point or type coordinate: ")) (command "-layer" "m" "DIM_WRONG" "c" "red" "DIM_WRONG" "p" "n" "DIM_WRONG" "s" "DIM_WRONG" "");(if T; ((10 . *) (100 . "AcDbOrdinateDimension") = !origin); (progn (nil)); (/= origin); (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) (if (setq ss (ssget "X" (list (cons 0 "DIMENSION")(cons 100 "AcDbOrdinateDimension")))) (repeat (setq x (sslength ss)) (setq obj (entget (ssname ss (setq x (- x 1))))) (setq StPt (cdr (assoc 10 obj))) (setq EdPt (cdr (assoc 11 obj))); (alert (strcat "x="(rtos (car StPt) 2 2) " y="(rtos (cadr StPt) 2 2))) ;; Changed to StPt? (if (not equal origin StPt) ;; Changed "=" to "equal"; (progn (entmake (list '(0 . "LINE") '(100 . "AcDbLine") (cons 10 StPt) ;; Changed to StPt (cons 11 EdPt) ;; Changed to EdPt; (foreach))))))(princ))A 'too many arguments' crops up.Otherwise the lisp draws lines on every ordinate dimension in the drawing.I'm trying to drop this down to either one of two things:
Drawing the line on WRONG ordinate dimensions and coloring the line RED to indicate as such. Then the user can correct those that are wrong.
OR
Drawing the line on CORRECT ordinate dimensions and coloring the line GREEN to indicate as such. Then the user can ignore those that are right and fix those that are wrong.
Please use the code I posted with the red NOT. The other has problems with the layer part. You didn't answer my question concerning whether not the code I provided drew lines from the displaced datum to the dimensions.It does for me and that's why I asked.
With regard to your question about switching to NOT EQUAL, you need to separate the NOT from the EQUAL with another set of "()":
(if (not (equal origin StPt)) ;; Changed "=" to "equal"
页:
1
[2]