Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Kent1Cooper
Posts: 5,239
Registered: ‎09-13-2004
Message 11 of 16 (228 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: 2,639
Registered: ‎12-17-2004
Message 12 of 16 (224 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: 593
Registered: ‎08-06-2002
Message 13 of 16 (193 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: 2,639
Registered: ‎12-17-2004
Message 14 of 16 (171 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

Distinguished Contributor
phanaem
Posts: 149
Registered: ‎02-06-2007
Message 15 of 16 (163 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: 2,639
Registered: ‎12-17-2004
Message 16 of 16 (159 Views)

Re: dotted pairs

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

phanaem,
great explanation.

 

Thank you very much.

 

Henrique

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community