CALCULATION IN LISP

CALCULATION IN LISP

Gaganpatel
Collaborator Collaborator
3,182 Views
39 Replies
Message 1 of 40

CALCULATION IN LISP

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

I want to calculation in auto lisp programming.

Please find the attached calculation.

Any body please help me.

 

0 Likes
3,183 Views
39 Replies
Replies (39)
Message 21 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please share how to use this programming.

Share one video.

0 Likes
Message 22 of 40

diagodose2009
Collaborator
Collaborator

Because, the last version is beta-version, and he contain too many issues/ that reason, 😁

 you make user account on the forum linked bellow.

 you send PM to user inside autoptic.zip & you edit rulesmd.bat

 we need practically projects with the clients for their needs.

0 Likes
Message 23 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

How to use

0 Likes
Message 24 of 40

diagodose2009
Collaborator
Collaborator

Clipboard01.jpg

0 Likes
Message 25 of 40

komondormrex
Mentor
Mentor

hi there,

check the following code. it  creates in active layout active layer a 3-column framed mtext with slope data based on input altitude and base in active layer with active textstyle and textsize, like this:

 

komondormrex_0-1698734724563.png

 

 

 

 

 

;*************************************************************************************************************************************

;	komondormrex, oct 2023

;*************************************************************************************************************************************

(vl-load-com)

;*************************************************************************************************************************************

(defun r_tos (string / chars_after_point)
	(if (> 8 (setq chars_after_point (1- (- (strlen string) (vl-string-search "." string)))))
		(strcat string (substr "0000000000" 1 (- 8 chars_after_point)))
		string
	)
)

;*************************************************************************************************************************************

(defun c:slope_mtext ( / 11\cos 1st_slope 1_cos 1_devlop 1_sin 1_tan 1_tan_b 21\cos 2nd_slope 2_cos 2_devlop 2_sin 2_tan 2_tan_b
						 altitude base basepoint base_point mtext_object text_scale text_size _princ
					 )
	(setq altitude (getdist (setq basepoint (getpoint "\nPick baseboint: ")) "\nEnter altitude: ")
		  _princ (princ altitude)
		  base (getdist basepoint "\nEnter base: ")
		  _princ (princ base)

		  1st_slope (sqrt (apply '+ (mapcar 'expt (list altitude base) '(2 2))))
		  2nd_slope (sqrt (apply '+ (mapcar 'expt (list 1st_slope base) '(2 2))))

		  1_tan    (/ base altitude) 		2_tan    (/ base 1st_slope)
		  1_tan_b  (* 2 1_tan)     			2_tan_b  (* 2 2_tan)
		  1_sin    (/ base 1st_slope)       2_sin    (/ base 2nd_slope)
		  1_cos    (/ altitude 1st_slope)   2_cos    (/ 1st_slope 2nd_slope)
		  11\cos   (/ 1st_slope altitude)   21\cos   (/ 2nd_slope 1st_slope)
		  1_devlop (/ 2nd_slope altitude)   2_devlop 1_devlop

		  mtext_object (vla-addmtext (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
								     (setq base_point (vlax-3d-point (getpoint "\nPick point for mtext positioning: ")))
									 0
								     "\\pxqc;"
					   )
	)
	(entmod (append (entget (vlax-vla-object->ename mtext_object)) '((75 . 1) (76 . 3))))
	(setq text_scale (+ (* 1.5 (setq text_size (getvar 'textsize)))
						(caadr (textbox (list '(0 . "TEXT") '(1 . "00.00000000") (cons 40 text_size) (cons 7 (getvar 'textstyle)))))
					 )
	)
	(vla-scaleentity mtext_object base_point text_scale)
	(vla-put-height mtext_object text_size)
	(entmod (append (entget (vlax-vla-object->ename mtext_object)) (list (cons 49 0))))	;	text_size))))
	(entmod (append (entget (vlax-vla-object->ename mtext_object))
					(list (cons 46 (* 1.65 8 text_size)) '(90 . 16) '(63 . 256) '(45 . 2.0) '(441 . 0)))
	)
	(vla-put-textstring mtext_object
						(strcat (vla-get-textstring mtext_object)
								"{\\L1st SLOPE}\n\n" (r_tos (rtos 1_tan 2 8)) "\n" (r_tos (rtos 1_tan_b 2 8)) "\n" (r_tos (rtos 1_sin 2 8)) "\n"
													 (r_tos (rtos 1_cos 2 8)) "\n" (r_tos (rtos 11\cos 2 8)) "\n" (r_tos (rtos 1_devlop 2 8)) "\\N\n\n"
								"TAN\n2TAN\nSIN\nCOS\n1/COS\nDEVLOP\\N"
								"{\\L2nd SLOPE}\n\n" (r_tos (rtos 2_tan 2 8)) "\n" (r_tos (rtos 2_tan_b 2 8)) "\n" (r_tos (rtos 2_sin 2 8)) "\n"
													 (r_tos (rtos 2_cos 2 8)) "\n" (r_tos (rtos 21\cos 2 8)) "\n" (r_tos (rtos 2_devlop 2 8))
						)
	)
	(princ)
)

;*************************************************************************************************************************************

 

 

updated_2

0 Likes
Message 26 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

Thanks for reply.

Appload this programming but command is not working.

Use Auto CAD 2013

 

0 Likes
Message 27 of 40

komondormrex
Mentor
Mentor

2013? wow(

what is the errors?
try to execute this function in command line (vl-load-com) <Enter>

0 Likes
Message 28 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

1)Appload the lisp file appload successful massage.

2) Type command Slope_mtext Press F1 for Help. (Error)

0 Likes
Message 29 of 40

komondormrex
Mentor
Mentor

make sure you load and run the code all the same.

komondormrex_0-1698745984871.gif

 

0 Likes
Message 30 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

Please share clear video.

Command is not showing.

0 Likes
Message 31 of 40

komondormrex
Mentor
Mentor

sorry, the code had errors, check the update.

0 Likes
Message 32 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

Sorry for auto cad 2013 not working

Auto cad 2020 working good. Thank you very much Sir.

one modify please 1st Slope value & 2nd Slope value text distance short required.

0 Likes
Message 33 of 40

komondormrex
Mentor
Mentor

you mean closer to numbers?

0 Likes
Message 34 of 40

diagodose2009
Collaborator
Collaborator

ASPdotNET_logo.jpg

Yes in autocad2011 not workiing the  " komondormrex" program Lisp/..

Please, you try, other program. try pp_gaganpatel_mtext.lsp

That reason, I use many autolisp old sources of VLISP.= dfn_color_ceinc, 

The😃 file "cl_aclayer_entmtext_2013_pp_gaganpatel_mtext.zip" is original-source.zip

I try to make source undertandable with math-Equations for fixing bugs of calculul, back to old-math  for corections more faster, or you can adding other/s calculus of math.

 

Command: appload
pp_gaganpatel_mtext.lsp successfully loaded.
Command:
Command.com=C:Q2[enter]
eFileNotFound pp_markoviewcube.VLAX->h_variants
Command:
Command: q2
Select Mtext-Entity:
Pick baseboint:Draw Altitude with mouse.com
Enter base:

 

  • Please you try your " pp_gaganpatel_mtext.lsp" programe , only inside "ciolpani_toponetracea.dwg "
  • You search  "berbec" with CTF+F or command (Find).
  • You must see the image - logo .
  • You select the entity Mtext with "Berbec" , otherwise you zoom-in the image-logo with mspaint.exe
0 Likes
Message 35 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please see the image. distance close required.

Gaganpatel_0-1698761603610.png

 

 

0 Likes
Message 36 of 40

komondormrex
Mentor
Mentor

sorry, that cannot be done. all columns have similar width. i zeroed gap and reduced width of each column a bit. that is it.

check update.

0 Likes
Message 37 of 40

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

How to use please share complete snapshot.

0 Likes
Message 38 of 40

komondormrex
Mentor
Mentor

get it from message #25

0 Likes
Message 39 of 40

diagodose2009
Collaborator
Collaborator

You found snapshot.gif inside the *.zip, attached.

 

Command: appload
pp_gaganpatel_mtext.lsp successfully loaded.
Command:
Command.com=C:Q2[enter]
(eFileNotFound pp_markoviewcube.VLAX->h_variants
Command:
Command: q2
Select Mtext-Entity:
Pick baseboint:Draw Altitude with mouse.com1.6
Enter base:1.4
1.NextCopy 0.exit:1
1.NextCopy 0.exit:1
1.NextCopy 0.exit:1

 

.
You see the snapshot.gif.

0 Likes
Message 40 of 40

john.uhden
Mentor
Mentor

@Gaganpatel ,

AutoLisp could simply be put as an assembly of operations which includes, if necessary, setting a symbol name (variable) to recall its value later.  The operation (verb) is followed by the values or variables containing values.

F'rinstance...

(setq r 2.0) ; sets the symbol name "r" to the radius ; (a real number)

(setq C (* 2 pi r)) ; that's the circumference ; (a real number) where pi is always in radians

(setq C/4 (/ C 4)) ; or (setq C/4 (* C 0.25)) ; a quarter of the circumference

; OR

(setq c/4 (* pi r 0.5))

 

It may look kindergardenish, but my first motto is "You gotta start somewhere."

Of course my 2nd motto is "If you don't know, ask." (You're off to a good start there!)

Please follow the other's responses better than mine.

John F. Uhden

0 Likes