Jump to content

Recommended Posts

Posted

Cursorsize changes the size, cursortype will change to Windows style pointer. But there isn’t a cursorcolor. Is there a way to use lisp to change the cursor color?

Posted (edited)

Its set in OLE_COLOR, so some color conversion might be necessary.

Or you can hardcode the color by changing it in the settings and retrieving the color-code using the first code below.

 

Here is how to get the current color:

(if (setq dis (vla-get-display (vla-get-Preferences (vlax-get-acad-object))))
  (vlax-variant-value (vlax-variant-change-type (vla-get-ModelCrosshairColor dis) vlax-vbLong)) ; Current color
)

 

And this way you can change the cursor color:

(if (setq dis (vla-get-display (vla-get-Preferences (vlax-get-acad-object))))
  (vla-put-ModelCrosshairColor dis 255) ; Change to red
)
Edited by dexus
Posted (edited)

Options, Display, there is an item cross hair color, in Bricscad. Its X Axis color Y axis color. I run Black background so colors like red are good.

No code required.

Edited by BIGAL
Posted

Try this.

;;Changing the color of CrossHair (transparent command)
(DEFUN C:CHCOL (/ c d l m n o p)
	(setq 	c (quote ("Black" "Red" "Yelow" "Green"  "Cyan"  "Blue"   "Magenta" "White"    "8"     "9"))
					l (quote (   0     255   65535   65280 16776960 16711680 16711935  16777215 8421504 12632256))
					d (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
					m l
					o	(vlax-variant-value
							(vlax-variant-change-type
								(if (= (getvar "TILEMODE") 0)
									(vla-get-layoutcrosshaircolor d)
									(vla-get-modelcrosshaircolor  d)
								)
								vlax-vbLong
							)
						)
					n	(member o l)
	)
	(cond
;;Rearrange list l with the First item = Current color from the list l
		(	(and n (/= o 0))
			(setq l (append n (vl-remove-if (function (lambda (x) (member x n))) l))) ;;(v1 v2 n v3 v4 v5 ...) -> (n v3 v4 v5 ... v1 v2)
		)
;;Add current color to lists
		(	(not n)
			(setq 	l (cons o l)
							m l
							c (cons (strcat (itoa (lsh (lsh o 24) -24)) "," (itoa (lsh (lsh o 16) -24)) "," (itoa (lsh o -16))) c)
			)
		)
		(T nil)
	)
	(princ
		(strcat
			"\nCurrent color: "
			(nth (vl-position (car l) m) c)
			". [Right Mouse Button/Enter Key/Space Key] to accept or any key to cycle CrossHair colors."
		)
	)
	(while
		(and 
			(not (vl-catch-all-error-p (setq p (vl-catch-all-apply (function grread))))) ;;<Esc>
			(not (equal p (quote (2 13)))) ;;<Enter>
			(not (equal p (quote (2 32)))) ;;<Space>
			(/= (car p) 25) ;;Right mouse button
		)
		(setq l (append (cdr l) (list (car l))))
		(if (= (getvar "TILEMODE") 0)
			(vla-put-layoutcrosshaircolor d (car l))
			(vla-put-modelcrosshaircolor  d (car l))
		)
		(princ (strcat "\nCrossHair Color: " (nth (vl-position (car l) m) c)))
	)
	(princ)
) ;;CHCOL

 

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