Recent Posts

Pages: 1 ... 8 9 [10]
91
AutoLISP (Vanilla / Visual) / changing Hatch color
« Last post by Fabricio28 on March 24, 2020, 08:40:27 AM »
Hi friends,

How are you?

In my project have about 300,000 pieces of hatches, there are 2 colors; red and green...
I'd like to change all red hatches to color 31 and green to 141 color.

I'm trying to using quick select, and isn't working. Maybe a lisp could help me.

Anybody could help me out, please?

File attached

Thank in advance
Fabrício
92
@T.Willey these are my results:
93
Why do you say there is no GOTO you can use defun statements, I wrote a bubble sort that required dual defuns for the testing part and looping through the data set. Took a BASIC version and rewrote in lisp.

Ps here is my GOTO Autocad command.
thank you
You don't see what I mean. My GOTO is executed in the middle of one LSP function to the middle of another.
94
Why do you say there is no GOTO you can use defun statements, I wrote a bubble sort that required dual defuns for the testing part and looping through the data set. Took a BASIC version and rewrote in lisp.

Ps here is my GOTO Autocad command.

GOTO is a very old programming concept and/or "thing". GOTO is for compiled languages and it is translated by the compiler as a "statement to jump to a specific memory address".  ...stack/heap discussions abound.

NOTE: you can also use GOTOs in windows command scripts too for a good visual aid of how they were used (made code messy and yucky).


The example used in the first post is quite interesting but I agree with VovKa.
made code messy and yucky.That's the purpose
Standard fas is equivalent to source code
You can send me an Fas, I give you its LSP source code
95
Coolio! I took my first programming course on a IIC. Th

Yesterday, I compile this source to (fas for Autocad)  and (des for BrisCad)
The programe Decompilator-exe can restore, reveal 100%autolisp-source?
Code: [Select]
       len=php_strlen(utmZone);
       // Changed from utmZone.Last as the Linq version is much slower than simply indexing
       // the last position in the string's array of characters
       if (len>1)
              {   isNorthHemisphere = substr(utmZone,len,1),
                  diflat = -0.00066286966871111111111111111111111111,
  diflon = -0.0003868060578,
                  utmZone = substr(utmZone,1,len-1);
  c_sa = 6378137.000000;
  c_sb = 6356752.314245;
  e2 = math_pow((math_Pow(c_sa, 2) - Math_Pow(c_sb, 2)), 0.5) / c_sb;
  e2cuadrada = Math_Pow(e2, 2);
  c = math_pow(c_sa, 2) / c_sb;
  x = utmX - 500000;
                  isNorthHemisphere =(isNorthHemisphere >"N")?T:nil;
  y = isNorthHemisphere ? utmY : utmY - 10000000;
                  zone=atoi(utmZone);
  s = ((zone * 6.0) - 183.0);
  lat = y / (6366197.724 * 0.9996); // Change c_sa for 6366197.724
  v = (c / math_pow(1 + (e2cuadrada * math_pow(cos(lat), 2)), 0.5)) * 0.9996;
  a = x / v;
  a1 = sin(2 * lat);
  a2 = a1 * math_pow((cos(lat)), 2);
  j2 = lat + (a1 / 2.0);
  j4 = ((3 * j2) + a2) / 4.0;
                  j6 = (5 * j4 + a2 * math_pow((cos(lat)), 2)) / 3.0; // saque a2 de multiplicar por el coseno de lat y elevar al cuadrado
  alfa = (3.0 / 4.0) * e2cuadrada;
  beta = (5.0 / 3.0) * math_pow(alfa, 2);
  gama = (35.0 / 27.0) * math_pow(alfa, 3);
  bm = 0.9996 * c * (lat - alfa * j2 + beta * j4 - gama * j6);
  b = (y - bm) / v;
                  epsi = ((e2cuadrada * math_pow(a, 2)) / 2.0) * math_pow((cos(lat)), 2);
                  eps = a * (1 - (epsi / 3.0));
  nab = (b * (1 - epsi)) + lat;
  senoheps = (math_exp(eps) - Math_Exp(-eps)) / 2.0;
  delt = atan(senoheps / (cos(nab)));
  tao = atan(cos(delt) * sin(nab) / cos(nab));
                  longitude = (delt / Math_PI) * 180 + s;
  latitude = (((lat + (1 + e2cuadrada * math_pow(cos(lat), 2) - (3.0 / 2.0) * e2cuadrada * sin(lat) * cos(lat) * (tao - lat)) * (tao - lat))) / Math_PI) * 180.0; // era incorrecto el calculo
  rr=strcat("\nLatitud: " ,rtos(latitude,2,12),"\tLongitud: " , rtos(longitude,2,12));

What language is this?
96
Why do you say there is no GOTO you can use defun statements, I wrote a bubble sort that required dual defuns for the testing part and looping through the data set. Took a BASIC version and rewrote in lisp.

Ps here is my GOTO Autocad command.

GOTO is a very old programming concept and/or "thing". GOTO is for compiled languages and it is translated by the compiler as a "statement to jump to a specific memory address".  ...stack/heap discussions abound.

NOTE: you can also use GOTOs in windows command scripts too for a good visual aid of how they were used (made code messy and yucky).


The example used in the first post is quite interesting but I agree with VovKa.

97
Why do you say there is no GOTO you can use defun statements, I wrote a bubble sort that required dual defuns for the testing part and looping through the data set. Took a BASIC version and rewrote in lisp.

Ps here is my GOTO Autocad command.

98
AutoLISP (Vanilla / Visual) / Re: Writing Lisp for Autocad
« Last post by BIGAL on March 23, 2020, 08:59:07 PM »
Just upload dwg and doc any way you can.
99
.NET / Re: casting xData.value to enum head scratcher
« Last post by Keith™ on March 23, 2020, 07:33:58 PM »
Ah .. so perhaps I'll give the 1071 group a try. Essentially I need to store an enum in xdata and retrieve it at a later date. enum is Int32 so that could possibly be the issue. I'll give it a shot and see what happens.
100
AutoLISP (Vanilla / Visual) / Re: Geometrical question: closest orthogonal point
« Last post by T.Willey on March 23, 2020, 06:14:02 PM »
If I understand, this should be what you are looking for.  It will return a list of the quadrant angles.

Code - Lisp: [Select]
  1. ....
  2.  
I have tried your version, can you tell me in which situations does it return a different result?
Thanks.

Here are returned results (no image)
Quote
Command: (test (getpoint) (getpoint) (getpoint))
(0.0 4.71239)

Command: (test (getpoint) (getpoint) (getpoint))
(4.71239 3.14159)

Command: (test (getpoint) (getpoint) (getpoint))
(0.0 4.71239)

You can see that they return different results for where points are picked.  My code does not allow for the two returned angles to be the same value, so if they were going to be the same value, it returns the other angle associated with that quadrant.

Quote
Command: (test (getpoint) (getpoint) (getpoint))
(3.14159 1.5708)

This is the result for picking the same point in the second (top-left) quadrant.  You get the Pi (180 degrees) and Pi/2 (90 degrees).

Hope that makes sense.
Pages: 1 ... 8 9 [10]