Trying to Create a 3DPOLY from a List

mgorecki
Collaborator
Collaborator

Trying to Create a 3DPOLY from a List

mgorecki
Collaborator
Collaborator

I'm trying to create a 3DPoly, but every time it draws it, it's only 2D.  Is there a setting I'm missing?  There is probably a simple answer, but I can't find it.

newPntList = ((-4.45 -3.511 0.29) (-4.2 -3.511 0) (-4.2 -3.765 0) (-4.45 -3.765 0.29)) 

 

I tried:

(apply 'command
 (append
  '(".3dpoly")
  newPntList
  '("")
 )
)

I even tried:

(setq pnt1 (nth 0 newPntList)
      pnt2 (nth 1 newPntList)
      pnt3 (nth 2 newPntList)
      pnt4 (nth 3 newPntList))
(command "3dpoly" pnt1 pnt2 pnt3 pnt4 "cl" "")

 

They both create a 2D polyline and disregard the Z from the list.

Can anyone shed some light on this?

 

Thanks

0 Likes
Reply
Accepted solutions (1)
423 Views
9 Replies
Replies (9)

Kent1Cooper
Consultant
Consultant
Accepted solution

What is your setting for the OSNAPZ System Variable?

Kent Cooper, AIA
0 Likes

Sea-Haven
Mentor
Mentor

Worked in Bricscad added "C" so it closes. Tried osnapz 0 or 1 did not make any difference, but ID will show z=0 depending on osnapz but a list of the pline shows Z=0.29.

0 Likes

Kent1Cooper
Consultant
Consultant

[I guess OSNAPZ is irrelevant, if it really only affects points returned by Osnapping.]

 

Both methods work for me, in 3D.  [The second one has an extraneous "" at the end -- not needed, because the close option finishes the command.]

 

Do you perhaps have some running Object snap mode(s) on and any other stuff drawn in the vicinity that it might be Osnapping to?

Kent Cooper, AIA
0 Likes

komondormrex
Advisor
Advisor

@mgorecki wrote:

I'm trying to create a 3DPoly, but every time it draws it, it's only 2D.  Is there a setting I'm missing?  There is probably a simple answer...


there always is and free of heck commands

 

(setq newPntList '((-4.45 -3.511 0.29) (-4.2 -3.511 0) (-4.2 -3.765 0) (-4.45 -3.765 0.29))
	  newPntList (apply 'append newPntList) 
	  3d_poly (vla-add3dpoly (vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
							 (vlax-safearray-fill (vlax-make-safearray 
							 							vlax-vbdouble
												 		(cons 1 (length newPntList))
												  )
												  newPntList
						     )
			  )
)

 

 

0 Likes

leeminardi
Mentor
Mentor

I've used the following successfully.

(command "_3dpoly" )		
(while (= (getvar "cmdactive") 1)
(repeat 
(setq x (length pntList))	 
(command "_non" (nth (setq x (- x 1)) pntList)) 
)					;end repeat 
(command "")			;end 3dpoly 
) 					; end while

 

lee.minardi
0 Likes

mgorecki
Collaborator
Collaborator

I have a command when the code first starts that turns off all of the osnaps. I thought it was off, I must have turned it on to test something and I forgot.  Yep, I feel stupid.

0 Likes

mgorecki
Collaborator
Collaborator

Thanks for the input, yes, I'll add the "c" to close it off.

0 Likes

mgorecki
Collaborator
Collaborator

Thank you for the code.

0 Likes

mgorecki
Collaborator
Collaborator

Thanks for taking the time to respond.

0 Likes