Jump to content

Recommended Posts

Posted (edited)
		(setq DIAM 0.25) ;; Set diameter (used in previous part of code to place a circle/sweep)
		(setq CIRSWEEP (entlast)) ;; Set last created object (a SOLID cilinder
		(setq CHANGEHEIGHT (/ DIAM 2) ;; Set radius (half of DIAMeter -> <0.125>)
		(command "_.move" CIRSWEEP "" "_non" '(0 0 0) "_non" '(0 0 CHANGEHEIGHT)) ;; Move last created object in Z value


Hi, based on above code it will not move the object.

Probably the variable (CHANGEHEIGHT) in the coordinates on the move command.  The value of DIAM isn't set so it could change.

If there is a simpler way to move a 'ENTLAST' in z value i would like to hear.  I tried the 'CHANGE' command to change Elevation, but that doesn't seem to work on solids for the lack of an 'elevation' property.

Edited by OMEGA-ThundeR
Posted (edited)

You need to close bracket before you comment line...

(setq CHANGEHEIGHT (/ DIAM 2))

 

		(setq DIAM 0.25) ;; Set diameter (used in previous part of code to place a circle/sweep)
		(setq CIRSWEEP (entlast)) ;; Set last created object (a SOLID cilinder
		(setq CHANGEHEIGHT (/ DIAM 2)) ;; Set radius (half of DIAMeter -> <0.125>)
		(command "_.move" CIRSWEEP "" "_non" '(0 0 0) "_non" '(0 0 CHANGEHEIGHT)) ;; Move last created object in Z value

 

Edited by marko_ribar
Posted

Hmz.. that was an easy mistake😅.

But i wonder if that would fix anything.  Cause in my case it still doesn't move the object after correcting that error.  But if i change the 'CHANGEHEIGHT' to a number, the object does move.

Posted (edited)

You are using qouted lists that AutoCAD literarily read... Instead of this, you have to say to CAD that the lists in final line has to be evaluated...

So, instead of this line :

(command "_.move" CIRSWEEP "" "_non" '(0 0 0) "_non" '(0 0 CHANGEHEIGHT))

You should write it like this :

(command "_.move" CIRSWEEP "" "_non" (list 0 0 0) "_non" (list 0 0 CHANGEHEIGHT))

 

That's all - it should work now as expected...

Edited by marko_ribar
  • Thanks 1
Posted
On 3/22/2024 at 7:25 PM, marko_ribar said:

You are using qouted lists that AutoCAD literarily read... Instead of this, you have to say to CAD that the lists in final line has to be evaluated...

So, instead of this line :

(command "_.move" CIRSWEEP "" "_non" '(0 0 0) "_non" '(0 0 CHANGEHEIGHT))

You should write it like this :

(command "_.move" CIRSWEEP "" "_non" (list 0 0 0) "_non" (list 0 0 CHANGEHEIGHT))

 

That's all - it should work now as expected...


Well, that LIST part worked like a charm (only did it on the part with the variable!

Care to explain why 'list' does make it work?  Perhaps i should read into this :) https://lee-mac.com/quote.html 

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