Author Topic: help on Selecting texts by its position due to another???  (Read 3415 times)

0 Members and 1 Guest are viewing this topic.

adnhmz

  • Guest
help on Selecting texts by its position due to another???
« on: May 29, 2012, 04:37:21 PM »
Hello '
I am a quantity surveyor in North of Iraq. I going to calculate and tabulate the types of additional steel bars (such as T20 & L=4m) vs the distribution spaces (DS=500 cm) and to do this i used this object selection filter formula:
Begin OR
Begin AND
Layer : Dist Spac
Object : Text
Text Value : 200
End AND
Begin AND
Layer  : Bar L
Object : Text
Text Value : *7T20*
Text Value : *L=400*
End And
End OR
it has worked with me fine just i want if there is a lisp or other formula set to calculate the number of the texts group that matches with all the creterians that i want  may be this could be by selection by positions such as text close to other text by fix distances or ranges and it drawing circle containg the two texts etc. ,thus i can calculate the number of the selection set of bars that i want exactly without manually works. thank you in advance

hermanm

  • Guest
Re: help on Selecting texts by its position due to another???
« Reply #1 on: May 29, 2012, 09:02:23 PM »
Based on your dwg, I would proceed thusly:

1) Select all TEXT objects on two layers which call out the additional bars.
2) For each TEXT object, find the closest TEXT object on the layer which specifies the dimension (extents) of the extra reinforcing, and which is perpendicular to the additional bar callouts. There appear to be some cases where this TEXT is missing.
3) Convert the latter TEXT object to a number, and use this number in conjunction with the bar spacing (what determines the bar spacing?) to calculate the number of bars for each TEXT object which specifies additional bars.
4) Keep a running total of each type of bar, and iterate all TEXT objects selected in #1.
5) Report # bars of each type upon completion.

You do not say if you have any AutoLISP experience.

If not, this would be an excellent chance to learn.

There are many talented people here who will be willing to help if you make the effort to learn.

Post your code.:)

And welcome to the swamp.

pBe

  • Bull Frog
  • Posts: 402
Re: help on Selecting texts by its position due to another???
« Reply #2 on: May 30, 2012, 06:21:51 AM »
Hello '
I am a quantity surveyor in North of Iraq. I going to calculate and tabulate the types of additional steel bars (such as T20 & L=4m) vs the distribution spaces (DS=500 cm) and to do this i used this object selection filter formula:

it has worked with me fine just i want if there is a lisp or other formula set to calculate the number of the texts group that matches with all the creterians that i want  may be this could be by selection by positions such as text close to other text by fix distances or ranges and it drawing circle containg the two texts etc. ,thus i can calculate the number of the selection set of bars that i want exactly without manually works. thank you in advance

Show final result , so I for one may be able to understand.  :-)

BTW: Yes, it would help a lot if you share nad post  the complete code here.
« Last Edit: May 30, 2012, 07:16:31 AM by pBe »

adnhmz

  • Guest
Re: help on Selecting texts by its position due to another???
« Reply #3 on: May 30, 2012, 12:50:54 PM »
Firslty i am thanking you very much for interesting... as it appear this is very rich and good collected people cad form ....
unfortunately at least for this few weeks i have not any more time to learn the very important programming system AutoLisp bt i am aiming to learn it as soon as possible..then i have not any code as macro or lisp all i have tried is those lines (creterions) in the (object selection filter) dialog box by FILTER command after researching ho can we use it from the net...so all i have these FILTER entris ,, about the steps of mr hermanm i understood it not completely , and i know it needs professional autolisp codes at least to make relation between the texts coordinations . .. however even i solve it i surely will share it here..my favourate cad form...welcome ..thanks alot

pBe

  • Bull Frog
  • Posts: 402
Re: help on Selecting texts by its position due to another???
« Reply #4 on: May 31, 2012, 09:56:29 AM »
Oh my.. Dont even know how to work the FI command.  :-D

I suppose you want a lisp equivalent of that. forgive me  adnhmz, i still dont understand.

Like the way you have difficulty understanding hermanm steps, thats how it is with me when reading your last post.

I'll try to decipher your mesage and start putting it together.




BlackBox

  • King Gator
  • Posts: 3770
Re: help on Selecting texts by its position due to another???
« Reply #5 on: May 31, 2012, 11:49:57 AM »
FWIW -

_GetClosestTextTo sub-function:
Code - Auto/Visual Lisp: [Select]
  1. (defun _GetClosestTextTo (eName / eData startPoint ss i points)
  2.   (if (and eName
  3.            (setq eData (entget eName))
  4.            (setq startPoint (cdr (assoc 10 eData)))
  5.            (setq ss
  6.                   (ssget "_x"
  7.                          (list (assoc 0 eData)
  8.                                (assoc 8 eData)
  9.                                (assoc 410 eData)))))
  10.     (progn
  11.       (setq i -1)
  12.       (while (setq e (ssname ss (setq i (1+ i))))
  13.         (if (not (eq e eName))
  14.           (setq points
  15.                (cons
  16.                  (cons
  17.                    (distance startPoint (cdr (assoc 10 (entget e))))
  18.                    e)
  19.                    points))))
  20.       (cdr (car (vl-sort points '(lambda (x y) (< (car x) (car y)))))))))
  21.  

Example:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:ClosestTextTo  (/ ss1 eName ss2)
  2.   (if (and (setq ss1 (ssget ":S:E:L" '((0 . "MTEXT,TEXT"))))
  3.            (setq eName (_GetClosestTextTo (ssname ss1 0)))
  4.            (setq ss2 (ssadd)))
  5.     (sssetfirst nil (ssadd eName ss2)))
  6.   (princ))
  7.  

This can easily be expanded, or modified to _GetClosest*To pretty much any entity, and should make for a good starting point.  :kewl:
« Last Edit: June 05, 2012, 10:05:08 AM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: help on Selecting texts by its position due to another???
« Reply #6 on: June 04, 2012, 10:43:57 PM »
adnhmz,
Can you explain what you do with the selection set once you have it?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

BlackBox

  • King Gator
  • Posts: 3770
Re: help on Selecting texts by its position due to another???
« Reply #7 on: June 05, 2012, 01:30:59 AM »
Oh yeah, was my code (posted above) able to help?
"How we think determines what we do, and what we do determines what we get."

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: help on Selecting texts by its position due to another???
« Reply #8 on: June 05, 2012, 08:01:45 AM »
Code: [Select]
(while (/= nil (setq e (ssname ss (setq i (1+ i)))))
equals

Code: [Select]
(while (setq e (ssname ss (setq i (1+ i))))
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: help on Selecting texts by its position due to another???
« Reply #9 on: June 05, 2012, 10:04:40 AM »
I copied the code from another project, and must have overlooked that when changing the prior function to Setq. Good looking out.  :-)
"How we think determines what we do, and what we do determines what we get."

adnhmz

  • Guest
Re: help on Selecting texts by its position due to another???
« Reply #10 on: July 01, 2012, 05:12:41 AM »
Mr RenderMan i thanking  you   for your cool work with this topic and other friends who interested with ths issue ..
i have tested the codes after making it autolisp files and  loading them to the autocad .. the first code didnt work after i typed (_GetClosestTextTo) in the command line... ( may i couldnt type the write command)..
the second code selected when i launched it but it selected a text that i didnt understand the relation between them.. but as i understand and you wrote its a start point to modirate it to a full code so that it selects the cases i want and explained in the image on this post .. i thing it need to input the code you have made to a selection set code  including the selection creteria that i made in the (objects selection filter ) dialog box ( in attached jpg) and combining them to make the desired selection without any manual work..and this procedures needs study of the VBA codes principles and for that i haven't time to learn at least for now.. so the pratic procedures that i made to do the selection is selecting all text matches 7T20 L=400 (for example) and selecting all distribution spaces lenghts of 400 (f.e.)  , doing this by FILTER command , and moving them to a place (with reference points ) near the drawing and counting them manually  as it shown in the attached drawings ... i hope some one benefits from my method in structural quantity surveying ..that is make me glad :) ...