Jump to content

Recommended Posts

Posted

Would someone be able to create a dimension lisp that:

Instead of numerical dimension, only shows a "?"

And also puts a rev cloud around it as well

 

I see when creating a new dimstyle, you can draw a frame around it. Didn't know if you could change that to a cloud automatically? I also need to be able to change the dimstyle its on as when we cloud different types of areas, they may need to be on a different layer. It can get tedious when dimensions are not given and I have to change each one to "? D.E." or "? E.O.S."

 

I've searched around for something like this but couldn't really find anything. Any help from the gurus here are appreciated as always.

 

Thanks,

Nobull

Posted (edited)

Try and see if this is what you searched for...

 

(defun c:d? ( / *error* DTR GetMTextBB ogt ch d mt pts p1 p2 p3 p4 pl )

 (defun *error* ( msg )
   (if ogt (setvar 'offsetgaptype ogt))
   (if msg (prompt msg))
   (princ)
 )

 (defun DTR ( a )
   (* (/ a 180.0) pi)
 )

 (defun GetMTextBB ( Ent / EntData EnsPt TxtJust TxtWd TxtHt TxtRot LeftX RightX TopY BottomY )
 ;;; Source : https://groups.google.com/forum/#!topic/autodesk.autocad.customization/gGZBLTD3Qls
 ;;; Get real Bounding Box for MText
 ;;; Tim Willey 03/2005
 ;;; Improved for any angle Text by mailmaverick 12-12-2013
 ;;; Thanks to OLD-CADaver for the tips on the DXF codes
 ;;; Points p1, p2, p3 and p4 are explained below :
 ;;; If the MTEXT gets rotated, the points remain the same.
 ;|
 ;
 p3                     p2
 ------------------------
 |                      |
 |                      |
 |                      |
 |                      |
 |                      |
 |                      |
 ------------------------
 p1                     p4
 ;
 |;
   (setq EntData (entget Ent))
   (setq InsPt (acet-dxf 10 EntData))
   (setq TxtJust (acet-dxf 71 EntData))
   (setq TxtRot (acet-dxf 50 EntData))
   (setq TxtWd (acet-dxf 42 EntData))
   (setq TxtHt (acet-dxf 43 EntData))
   (cond    
     ((= TxtJust 1)
      (setq p3 InsPt)
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
      (setq p2 (polar p3 TxtRot TxtWd))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 2)
      (setq p3 (polar Inspt (+ (DTR 180) TxtRot) (/ TxtWd 2)))
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
      (setq p2 (polar p3 TxtRot TxtWd))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 3)
      (setq p2 Inspt)
      (setq p3 (polar p2 (+ (DTR 180) TxtRot) TxtWd))
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 4)
      (setq p3 (polar Inspt (+ (DTR 90) TxtRot) (/ TxtHt 2)))
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
      (setq p2 (polar p3 TxtRot TxtWd))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 5)
      (setq temp (polar Inspt (+ (DTR 90) TxtRot) (/ TxtHt 2)))
      (setq p3 (polar temp (+ (DTR 180) TxtRot) (/ TxtWd 2)))
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
      (setq p2 (polar p3 TxtRot TxtWd))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 6)
      (setq p2 (polar Inspt (+ (DTR 90) TxtRot) (/ TxtHt 2)))
      (setq p3 (polar p2 (+ (DTR 180) TxtRot) TxtWd))
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 7)
      (setq p1 Inspt)
      (setq p3 (polar p1 (+ (DTR 90) TxtRot) TxtHt))
      (setq p2 (polar p3 TxtRot TxtWd))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 
      (setq p1 (polar Inspt (+ (DTR 180) TxtRot) (/ TxtWd 2)))
      (setq p3 (polar p1 (+ (DTR 90) TxtRot) TxtHt))
      (setq p2 (polar p3 TxtRot TxtWd))
      (setq p4 (polar p1 TxtRot TxtWd))
     )
     ((= TxtJust 9)
      (setq p4 Inspt)
      (setq p2 (polar p4 (+ (DTR 90) TxtRot) TxtHt))
      (setq p3 (polar p2 (+ (DTR 180) TxtRot) TxtWd))
      (setq p1 (polar p3 (+ (DTR 270) TxtRot) TxtHt))
     )
   )
   (list p1 p2 p3 p4)
 )

 (setq ogt (getvar 'offsetgaptype))
 (setvar 'offsetgaptype 0)
 (if (not (tblsearch "LAYER" "dim_revcloud"))
   (entmake '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "dim_revcloud") (70 . 0) (62 . 6) (6 . "Continuous")))
   (prompt "\nLayer : \"dim_revcloud\" already exist - setting it to current and proceeding with routine...")
 )
 (setvar 'clayer "dim_revcloud")
 (initget "1 2")
 (setq ch (getkword "\nChoose text of dimension [1.? D.E. / 2.? E.O.S.] <?>: "))
 (cond 
   ( (eq ch nil)
     (prompt "\nPick start and end point of linear dimension...") 
     (command "_.dimaligned" "\\" "\\" "t" "?")
     (while (> (getvar 'cmdactive) 0) (command "\\"))
   )
   ( (eq ch "1")
     (prompt "\nPick start and end point of linear dimension...")
     (command "_.dimaligned" "\\" "\\" "t" "? D.E.")
     (while (> (getvar 'cmdactive) 0) (command "\\"))
   )
   ( (eq ch "2")
     (prompt "\nPick start and end point of linear dimension...")
     (command "_.dimaligned" "\\" "\\" "t" "? E.O.S.")
     (while (> (getvar 'cmdactive) 0) (command "\\"))
   )
 )
 (setq d (entlast))
 (setq mt (car (nentselp (mapcar '/ (mapcar '+ (acet-dxf 10 (entget d)) (acet-dxf 11 (entget d))) '(2.0 2.0 2.0)))))
 (if (not (eq (acet-dxf 0 (entget mt)) "MTEXT"))
   (while (not (eq (acet-dxf 0 (entget (setq mt (entnext mt)))) "MTEXT")))
 )
 (setq pts (GetMTextBB mt))
 (setq p1 (car pts) p2 (cadr pts) p3 (caddr pts) p4 (cadddr pts))
 (command "_.pline" p1 p4 p2 p3 "c")
 (setq pl (entlast))
 (command "_.offset" "t" pl (mapcar '+ p2 (mapcar '- p2 p1)) "")
 (command "_.revcloud" "s" "n" "o" (entlast) "")
 (entdel pl)
 (*error* nil)
 (princ)
)

HTH, M.R.

Edited by marko_ribar
Posted

That is the basically what I am after. is it possible to add a revcloud around the text automatically? I also need to be able to change layers but I have a guy here who should be able to do that if I can't. Thanks for the command though. I think it is already a help as it is but the cloud would make it golden.

 

Thanks again,

Nobull

Posted

I figured out the layers. But the revcloud function seems to act odd. It doesn't make a cloud around, more through it. And am I able to choose calligraphy style (as that is what we use for everything else). Sorry I'm definitely a newbie with lisp. I plan on setting some time aside to study the various tutorials available.

 

-Nobull

  • 4 weeks later...
Posted

Is anyone out there available to look at the code listed above? It's close to what I need but just a little buggy...

 

-Nobull

Posted
Is anyone out there available to look at the code listed above? It's close to what I need but just a little buggy...

I haven't had much time for CADTutor lately, but I took a quick look at this. The Revcloud did not show up at all when I ran it, nor did the Rectangle it is supposed to be made from.

 

The routine appears to have an OFFSET that might control the size of the Revcloud. Perhaps you should upload a drawing with your results for someone to evaluate.

 

As for your layer issue, just change "dim_revcloud" to your name here.

(setvar 'clayer "dim_revcloud")

Or, if your layer doesn't exist, then change all "dim_revcloud" occurrences.

Posted

I figured out the layer issue already but its the cloud giving me troubleCapture.PNG

 

Attached is how it comes out if you do a dimension over a certain size which may be another issue. The cloud does not appear if the dimension used is too small.

 

It also only allows the suffix, i.e. "D.E." or "E.O.S." to be determined by using the number keypad and not simply hitting enter. It's not user friendly as it stands but those little issues are really the least of my worries with this one. The main thing required is getting the cloud to show up correctly and possible to change the cloud style to calligraphy.

 

Any help would be much appreciated.

 

-Nobull

Posted
I figured out the layer issue already
That's very good, but really you should post the solution so that others can benefit as well.

 

but its the cloud giving me trouble.

Attached is how it comes out if you do a dimension over a certain size which may be another issue. The cloud does not appear if the dimension used is too small.

Your additional information is helpful here. The image is OK. Often, a DWG is much better.

 

Take a look at all of the options for the REVCLOUD command, as it is actually used in the routine. See this line:

(command "_.revcloud" "s" "n" "o" (entlast) "")

Where it has "n", you should put "c" if you want calligraphy. Simple as that. The Arc length option may come in useful as well.

Posted
It also only allows the suffix, i.e. "D.E." or "E.O.S." to be determined by using the number keypad and not simply hitting enter. It's not user friendly as it stands but those little issues are really the least of my worries with this one.
Well, with my previous reply, you should be well on your way to fixing the main things.

 

Your problems with the input are not clear to me. How would you suggest setting it up so that just hitting Enter will choose whatever you want? AFAIK, that only works when you are always choosing the default. Marko set it up with 3 choices, because that is what you indicated. Do you really have only one choice? In that case, you would not even need to hit Enter. Just hardcode it into the routine. Perhaps you have one main choice and the others are not so common? Then, set that one up to be your default. If you have other ideas, but do not know how to implement them, then spell it out more clearly including showing how you imagine the prompt should look. That's the kind of thing that would really help someone else fix it for you. BTW, what do your D.E and E.O.S. stand for?

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...