duanuys 发表于 2022-7-5 23:15:59

error: bad argument type: 2D/3

Here is the code, and i tried commenting it so it is easy to follow, in a nutshell all this is doing is creating a circle, hatching it with the color red, and making a line from the center upwards and making it red..
 
Now it runs all of this perfectly smoothly.. but when i copy and paste the exact code block that generates the line going up and just change some variables so that the line goes down.. it gives me the error in my title.. what gives??
 

((= choice 2)(setq gas_redo 0)(setq gas_another 0)(while (/= gas_redo 1)        (prompt "\nYou have chosen Gas")        (setq pg_cpo1 (getpoint "\nPick well location"))        (setq pg_cpo2 (polar pg_cpo1 (dtr 90.0) edge))                                (command "circle" "2p" pg_cpo1 pg_cpo2)                        ;draw circle                                                (setq pg_hw (polar pg_cpo1 (dtr 90.0) (/ edge 2)))        (command "-hatch" pg_hw "P" "S" "CO" "T" "255,0,0" "" ""); hatch the circle with COLOR_RED                                        (setq pg_NL1 (polar pg_cpo1 (dtr 90.0) edge))                ;set points for north line        (setq pg_NL2 (polar pg_NL1 (dtr 90.0) (/ edge 2)))        ; "   "        (command "line" pg_NL1 pg_NL2 "")                        ; drew line north of circle        (command "change" pg_NL2 "" "P" "CO" "T" "255,0,0" ""); changed the line color to red                                        (setq pg_SL1 (polar pg_cpo1 (dtr 270.0) edge))                ;IT DOESN"T LIKE THIS CODE BLOCK        (setq pg_SL2 (polar pg_SL2 (dtr 270.0) (/ edge 2)))        (command "line" pg_SL1 pg_SL2 "")        (command "change" pg_SL2 "" "P" "CO" "T" "255,0,0" "")                                        (setq gas_another(getint "\nCreate another? (1)YES or (2)NO"))        (if (= gas_another 2) (setq gas_redo 1) (prompt"\nDrawing another Gas Well.."))))

MSasu 发表于 2022-7-5 23:36:05

At a glance, seems that pg_NL2 variable is holding a point, not a line entity:

(command "line" pg_NL1 pg_NL2 "")   ; drew line north of circle(command "change" pg_NL2 (entlast) "" "P" "CO" "T" "255,0,0" "")Same here:

(command "line" pg_SL1 pg_SL2 "")(command "change" pg_SL2 (entlast) "" "P" "CO" "T" "255,0,0" "")
 
 
 
As for locating the source of that error, I suggest you to check Lee Mac's tutorial on debugging, since to locate the issue will need to review the entire code, not just an excerpt.

duanuys 发表于 2022-7-5 23:56:05

 
 
Thankyou MSasu,
 
I will go that link and give it a shot, well i know that the pg_LN1 isn't a line entity, but all i am doing is replicating the change command as if i was doing it on an empty project, and where it asks for selecting objects, normally you would click on the line, but isn't clicking just choosing coordinates, so i used that variable as a coordinate because I know it will fall on the line, therefore selecting it.

BIGAL 发表于 2022-7-6 00:26:31

Another suggestion like Msasu
 

(command "-hatch" pg_hw ........(command "-hatch" (entlast) .........;hatches circle as last entity
页: [1]
查看完整版本: error: bad argument type: 2D/3