Jump to content

error: bad argument type: 2D/3D point: nil (Makes no sense!)


duanuys

Recommended Posts

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.."))
)
)

Link to comment
Share on other sites

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" [color=red][s]pg_NL2[/s][/color] [color=red](entlast)[/color] "" "P" "CO" "T" "255,0,0" "")

Same here:

(command "line" pg_SL1 pg_SL2 "")
(command "change" [color=red][s]pg_SL2[/s][/color] [color=red](entlast)[/color] "" "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.

Link to comment
Share on other sites

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" [color=red][s]pg_NL2[/s][/color] [color=red](entlast)[/color] "" "P" "CO" "T" "255,0,0" "")

Same here:

(command "line" pg_SL1 pg_SL2 "")
(command "change" [color=red][s]pg_SL2[/s][/color] [color=red](entlast)[/color] "" "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.

 

 

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...