# Thread: Lisp for "dividing" objects

1. ## Lisp for "dividing" objects

Registered forum members do not see this ad.

Hi friends...
I think my "problem" here is pretty ez to be solved...

Well, let´s make a "situation" here:

- I draw a line of any size (any angle too). For eg.: 5,5 units;
- I want it to be divide in MAX spaces of (let´s say...) 0,31 units (It means that this "max distance" of 0,31 units can be lower);
- All that with only 1 click (to select the object) and a single "question", like: "maximum distance", where I´ll input that value of 0,31units.

Finally...
My object would be divided equaly...

There´s this command DIVIDE where the PDMODE system variable is used (pdmode = 2 would be nice... I think).
But with this DIVIDE thing, you must have an idea of how many parts the object can be divided, so that 0,31units distance doesn´t turn into a 0,01units distance...

And that´s my "problem"...

Any ideas to help me out?

2. OK, that sounds pretty easy but let me just clarify what you need:

Say you have a line 12 units long and a max length value of 5.
5 goes into 12 twice, so there must be 3 lenghts overall.
3 into 12 goes 4 so the result of line length 12 and max length 5 is 3 lengths of 4 units.

Do I understand you correctly?

3. EXACTLY!!!!!!

That´s right friend...

Is it really e-z? Cuz I just figure it out in a simple way...

I´ll be waiting here for the next step..

Thanks a lot...

4. Well...
Here it is...
My friend here @ my work just solved the problem, and I think it´s pretty simple...

Anything to add would be welcome.
And thanks everyone..

Code:
```&#40;vmon&#41;
&#40;defun c&#58;esp &#40;&#41;
&#40;setq espc &#40;getreal "\nDistância máxima entre ferros&#58; "&#41;&#41;
&#40;setq ob1 &#40;car &#40;entsel "\nSelecione Objeto&#58; "&#41;&#41;&#41;
&#40;setq ob2 ob1&#41;
&#40;setq ob1 &#40;vlax-ename->vla-object ob1&#41;&#41;
&#40;setq enn &#40;vlax-get-property ob1 'length&#41;&#41;
&#40;setq qtte &#40;itoa &#40;fix&#40;+&#40;/ enn espc&#41;1&#41;&#41;&#41;&#41;
&#40;command "divide" ob2 qtte&#41;
&#40;princ&#41;
&#41;
&#40;print "Para Rodar o Programa Digite esp"&#41;```
ps.: the language there is portuguese, just in case anyone asks... lol

5. After Selecione Objeto: I am getting ; error: ActiveX Server returned the error: unknown name: LENGTH

I have Portugese-English dictionary handy. Would FERROS be BOLTS, POINTS. or what in English?

6. Originally Posted by JimWebster
After Selecione Objeto: I am getting ; error: ActiveX Server returned the error: unknown name: LENGTH

I have Portugese-English dictionary handy. Would FERROS be BOLTS, POINTS. or what in English?
Hi Jim, now it´s close to what I wanted. I also translated the portuguese parts so you can understand it better, just take a look:

Code:
```&#40;vmon&#41;
&#40;defun c&#58;DIVID &#40;&#41;
&#40;setvar "pdmode" 2&#41;
&#40;setq espc &#40;getreal "\Max distance between points&#58; "&#41;&#41;
&#40;setq ob1 &#40;car &#40;entsel "\nSelect Object&#58; "&#41;&#41;&#41;
&#40;setq ob2 ob1&#41;
&#40;setq ob1 &#40;vlax-ename->vla-object ob1&#41;&#41;
&#40;setq enn &#40;vlax-get-property ob1 'length&#41;&#41;
&#40;setq qtte &#40;itoa &#40;fix&#40;+&#40;/ enn espc&#41;1&#41;&#41;&#41;&#41;
&#40;command "divide" ob2 qtte&#41;
&#40;princ&#41;
&#41;
&#40;print "To use this program type DIVID"&#41;```

It now has the (setvar "pdmode" 2) line. It is the same as typing DDPTYPE and selecting the third symbol.

The "problem" is that we can only use this lisp with LINES. We are working here so it can be used in splines, plines, arcs, circles, etc....

And FERRO means IRON, but we actually mean STEEL, which is AÇO in portuguese.
That´s how the "aço" "divides" inside our concrete panels.

Thanks!

7. To get lengths of all (?) curve types, you need to use;

vlax-curve-getEndParam and
vlax-curve-getDistAtParam

where the "parameter" for the second function is determined by the first function.

HTH!

8. Gotcha fade2blackened. I'm looking forward to the finished product now.
I tested the English version and it works great.

I spent about 3 years working in Buenos Aires, Argentina. At which point I learned a little Spanish.
My company also has an office in Sao Paulo (Lockwood Greene), so I have gotten to meet a
few people from Brazil. All of the above sparked my interest concerning the Portugese language.
Therefore, I purchased a Portugese-English dictionary for a low price in Buenos Aires.
I'm assuming by your photo that Brazil has mostly concrete construction, the same as Argentina.
Correct? Being for the United States that is odd, since most construction here is wood or steel.

9. Originally Posted by JimWebster
Gotcha fade2blackened. I'm looking forward to the finished product now.
I tested the English version and it works great.

I spent about 3 years working in Buenos Aires, Argentina. At which point I learned a little Spanish.
My company also has an office in Sao Paulo (Lockwood Greene), so I have gotten to meet a
few people from Brazil. All of the above sparked my interest concerning the Portugese language.
Therefore, I purchased a Portugese-English dictionary for a low price in Buenos Aires.
I'm assuming by your photo that Brazil has mostly concrete construction, the same as Argentina.
Correct? Being for the United States that is odd, since most construction here is wood or steel.

Thanks Jim...
I´ll soon post the "final version". At my works it comes really handy... I hope it helps you somehow too.

That photo is of a building (INAJAROBA, in São Paulo) I was working on (panels) some months ago and I can say it´s a "luxury building" to live in... Too much for me...

Now I´m just a lil curious to know what you do... if I might say "what are you?" (lol).

See you soon friend...

10. Registered forum members do not see this ad.

I'm a Structural Steel Detailer. With the most of my experience in the prefab metal building trade.
I studied to be an Architect and that was my ambition. But due to a high unemployment rate in the
USA at the time that I finished school, and the fact that I had a family to support, I started doing
structural steel detailing work. And now over 20 years later, here I still am. For the past 5 years
I have been working for an international engineering and design firm.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts