Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Kent1Cooper
Posts: 5,872
Registered: ‎09-13-2004
Message 11 of 16 (234 Views)

Re: dotted pairs

10-19-2012 09:02 AM in reply to: hmsilva

Even forgetting the 33-1/2 million size of the full-length numbers, and considering only the range in values between the extremes, being off by 1 out of 227 is still pretty good -- less than 1/2 of 1% off.  I can't imagine that the difference in appearance could possibly be detectable.  I would still love to know what those first 5 digits that are the same in all values are accomplishing.

Kent Cooper
*Expert Elite*
hmsilva
Posts: 3,356
Registered: ‎12-17-2004
Message 12 of 16 (230 Views)

Re: dotted pairs

10-19-2012 09:10 AM in reply to: Kent1Cooper

Kent Cooper wrote:


...I would still love to know what those first 5 digits that are the same in all values are accomplishing.

 

is puzzling!

 

Henrique

Distinguished Mentor
owenwengerd
Posts: 686
Registered: ‎08-06-2002
Message 13 of 16 (199 Views)

Re: dotted pairs

10-29-2012 08:47 PM in reply to: hmsilva

The high byte is the transparency method (0 = ByLayer, 1 = ByBlock, 2 = ByAlpha), the low byte is the alpha value from 0 to 255.

--
Owen Wengerd
ManuSoft
*Expert Elite*
hmsilva
Posts: 3,356
Registered: ‎12-17-2004
Message 14 of 16 (177 Views)

Re: dotted pairs

10-30-2012 07:43 AM in reply to: owenwengerd

Owen Wengerd wrote:

 

The high byte is the transparency method (0 = ByLayer, 1 = ByBlock, 2 = ByAlpha), the low byte is the alpha value from 0 to 255.

 

I Owen,

Is possible to explain me little more?

 

Thanks

Henrique

Mentor
phanaem
Posts: 153
Registered: ‎02-06-2007
Message 15 of 16 (169 Views)

Re: dotted pairs

10-30-2012 10:14 AM in reply to: Kent1Cooper

Kent1Cooper wrote:

Even forgetting the 33-1/2 million size of the full-length numbers, and considering only the range in values between the extremes, being off by 1 out of 227 is still pretty good -- less than 1/2 of 1% off.  I can't imagine that the difference in appearance could possibly be detectable.  I would still love to know what those first 5 digits that are the same in all values are accomplishing.


Acording to DXF reference, code 440 holds a 32 bit integer and the high-order byte (8 bits) is 2.

That is hexadecimal 0x02000000 and decimal 33554432.

To represent transparency, to this value is added a number between 0 (100% transparency) and 255 (0% transparency). (well, you can't set a transparency higher than 90% so the minim value, coresponding to 90%, is 25)

You can get this value by interpolating linear for n% transparency:  x = integer(255-n*255/100)

 

For demonstration, look at this lisp:

(defun C:TEST ( / e n)
  (if
    (and
      (setq e (car (entsel)))
      (setq n (getint "\nTransparency: "))
      (<= 0 n 90)
      )
    (entmod
      (append
        (entget e)
        (list (cons 440 (+ (lsh 2 24) (fix (- 255 (* n 2.55))))))
        )
      )
    )
  )

 

*Expert Elite*
hmsilva
Posts: 3,356
Registered: ‎12-17-2004
Message 16 of 16 (165 Views)

Re: dotted pairs

10-30-2012 10:26 AM in reply to: phanaem

phanaem,
great explanation.

 

Thank you very much.

 

Henrique

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.