Jump to content

automatic distance


gazzalp

Recommended Posts

If you really want to test out your skills, see if you can think of a way to link the three items together, so we would only have to click on the line, and have the command recognise the bubble number and other number belongs to that. I believe this would be pretty difficult...

 

This really would be pretty difficult - ACAD is a pretty "dumb" program - and I don't mean that in the offensive way - its a useful program to use. But it just sees entities as lines, and circles. Unlike other programs, it won't recognise one line as being, say, a pipe, or a valve etc etc and realise that they are linked.

 

The only way I would say that you could link entities in this way is by use of a block or xref - which, as stated earlier is out of the question in this situation.

 

But I think my skills have been tested enough, and it has been fun to work through this problem with you Gazzalp, and I hope it saves you some time in the future.

Link to comment
Share on other sites

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    30

  • gazzalp

    24

  • BIGAL

    2

  • Ritch7

    1

Top Posters In This Topic

Posted Images

Another thought - Using my LISP you have to select each and every set of four objects - two lines, block and text.

 

For future use, why not add two more attributes to your block, namely the line length and line number, and enter these attributes upon drafting the lines.

 

Then, although slightly tedious at first, one can extract all the data in one swoop (using eattext), and if any updates need to be made, these can be made and then the data hastily extracted again without having to go through the process of selecting all the items.

Link to comment
Share on other sites

Good idea about adding the line number to the block of the bubble, but i still cant see the line length attribute working. We always draw the line first, so would there be a way we could draw the line; insert our block, it asks us for what line that block represents, and puts the block in a certain position. That way all elements are linked.... The way you suggested it seems like we couldnt have the line drawn, but wed have to input the length of the line (not easy as it goes from one end of our plan to the other, ie 42705.6mm) and all lines vary in length.

Link to comment
Share on other sites

Ok, try this:

 

It will insert your block and prompt you to select the line to be "linked" with it.

 

(defun c:bub () (c:bubbleblock)) ; Program Shortcut

(defun c:bubbleblock (/ *error* varLst oldVars pt lin linnum bub ent linlen)

 ;     --- Error Trap ---

   (defun *error* (msg)
   (mapcar 'setvar varLst oldVars)
   (if (= msg "")
       (princ "\nFunction Complete.")
       (princ "\nError or Esc pressed... ")
   ) ;_  end if
   (princ)
   ) ; end of *error*

   (setq varLst  (list "CMDECHO" "CLAYER")
     oldVars (mapcar 'getvar varLst)
   ) ; end setq 

 ;    --- Error Trap ---  

   (setvar "cmdecho" 0)
   (while
   (and
       (setq pt (getpoint "\nSpecify Point for Bubble: "))
       (setq lin (car (entsel "\nSelect Associated Line: ")))
       (setq linnum (getstring "\nSpecify Line Number: "))
       (setq bub (getstring "\nSpecify Bubble Number: "))
   ) ;_  end and
      (setq ent (entget lin))
      (setq linlen (rtos (distance (cdr (assoc 10 ent)) (cdr (assoc 11 ent)))))
      (makelay "Text")
      (command "-insert"            [color=Red][b]"C:\\" ;; Insert Filepath here[/b][/color]
           pt                ""                ""
           "0"                bub                linlen
           linnum
          ) ;_  end command
   ) ;_  end while
   (*error* "")
   (princ)
) ;_  end defun

(defun makelay (y)
   (if    (not (tblsearch "Layer" y))
   (command "-layer" "m" y "")
   (setvar "clayer" y)
   ) ;_  end if
) ;_  end defun

 

You will need to specify the filepath of the block, and I have attached the block that you will need to use.

Bubble Block.dwg

Link to comment
Share on other sites

Lee, it looks like it starts tyo weork but then comes up with:

 

Command: bub

Specify Point for Bubble:

Select Associated Line:

Specify Line Number: 100

Specify Bubble Number: 4

Unknown command "BUB". Press F1 for help.

Unknown command "BUB". Press F1 for help.

Unknown command "0". Press F1 for help.

Unknown command "4". Press F1 for help.

Unknown command "1413.585". Press F1 for help.

Unknown command "100". Press F1 for help.

 

Not sure if i'm not putting in the filepath correctly, but ive put it in where you had the red text. The location for this example is just: C:\Distill

 

which i put in place of the red text. Not sure if im doing something wrong...

Link to comment
Share on other sites

Now that im a bit more awake i realised i put it in the wrong spot, so ive put it in the right spot but still get an error. It looks through all my search paths, and then says Error or Esc pressed...

 

Ive put the block in an area my computer is looking for and changed the lisp file to look there, so not sure what is wrong....

Link to comment
Share on other sites

OK its 7am, and i must also be blonde, ive figured out what i was doing wrong. So now that weve inserted that block and its assigned to that line, im guessing the old lisp routine wont work (because its asking for the lines and bubble and number to be picked, whereas the whole point of this was to only pick one thing...

 

Also, if this all gets working it will be great, but will there be a way that we can do this lisp for the first line, then instead of picking each line again and where we want the balloon (this will look quite messy, all balloons wont line up exactly), we can copy the balloon to another line, and just change the properties to be looking at another line (hope that makes sense)

Link to comment
Share on other sites

OK its 7am, and i must also be blonde, ive figured out what i was doing wrong. So now that weve inserted that block and its assigned to that line, im guessing the old lisp routine wont work (because its asking for the lines and bubble and number to be picked, whereas the whole point of this was to only pick one thing...

 

I'm just providing another option.

 

Also, if this all gets working it will be great, but will there be a way that we can do this lisp for the first line, then instead of picking each line again and where we want the balloon (this will look quite messy, all balloons wont line up exactly), we can copy the balloon to another line, and just change the properties to be looking at another line (hope that makes sense)

 

The block provided is just that - a block. You can copy it to where you like and edit the attributes.

Link to comment
Share on other sites

With editing the attributes, again thats what i was hoping the program would do - save us time by knowing the line length. Currently what we have to do is measure our lines, put them in an excel spreadsheet next to the line number, and add the bubble number. Ultimately id like to have to only click on one line, and the program recognises there is a block linked to that line, and extract the info to excel. However we have all our lines drawn first, and then come later and add our block (add one block, and copy it up the page from one line to the next) which is alot quicker and simpler than adding the block for each line. I was hoping once we added one block and linked the two items(like your prgram does) we could then copy the block to the next line, but maybe do a command to say that this new block that weve created (by copying) is linked to the next line.

Link to comment
Share on other sites

Do your bubbles have a line connecting the bubble to the line ? if so read my other response on this forum re tables and chairs about storing a known point and saving it the block. Routine 1 insert new block routine 2 copy a block but update attributes.

Link to comment
Share on other sites

Just read it then, seems quite complicated.... No we dont have a line connecting the bubble to the block, but if need be i guess we could always add one...

Link to comment
Share on other sites

Again, its that issue of ACAD recognising which block goes with which line - I suppose its a toss up between using the LISP to insert the block for each line - that way you won't have to measure the line yourself; or not using the attributed block and selecting the three items to write it to Excel.

Link to comment
Share on other sites

Yeah it is, we can have 100 lines or more, all of varying lengths. Ill have a think about it, but now that ive done all this work my boss wants me to get into VBA anyway.... thanks for all your help though Lee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...