Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to Create a 3DPOLY from a List

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
mgorecki
319 Views, 9 Replies

Trying to Create a 3DPOLY from a List

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

9 REPLIES 9
Message 2 of 10
Kent1Cooper
in reply to: mgorecki

What is your setting for the OSNAPZ System Variable?

Kent Cooper, AIA
Message 3 of 10
Sea-Haven
in reply to: mgorecki

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.

Message 4 of 10
Kent1Cooper
in reply to: mgorecki

[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
Message 5 of 10
komondormrex
in reply to: mgorecki


@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
						     )
			  )
)

 

 

Message 6 of 10
leeminardi
in reply to: mgorecki

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
Message 7 of 10
mgorecki
in reply to: Kent1Cooper

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.

Message 8 of 10
mgorecki
in reply to: Sea-Haven

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

Message 9 of 10
mgorecki
in reply to: komondormrex

Thank you for the code.

Message 10 of 10
mgorecki
in reply to: leeminardi

Thanks for taking the time to respond.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report