Author Topic: flipbrg ??  (Read 4841 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
flipbrg ??
« on: March 06, 2008, 02:38:34 PM »
http://www.theswamp.org/index.php?topic=1417.0

i know this is from a very very very old thread, but i was reading old ones last night....

is flipbrg an autocad command or a routine, i googled it but came up with nothing. thoughts?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

deegeecees

  • Guest
Re: flipbrg ??
« Reply #1 on: March 06, 2008, 02:45:34 PM »
Quote
(defun C:FLIPBRG (/ ENAME ELST TXT OLDVAL NEWVAL CNT SSL SUF PRE BDY XPR)

That is a defined function within the Lisp coding, not a native AutoCad command. You'll need to load the Lisp file into your AutCad session in order to have it available to you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: flipbrg ??
« Reply #2 on: March 06, 2008, 02:49:01 PM »
i searched the forum and google for it, but i can't find this routine.
could/would someone post it or direct me to a link? please?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: flipbrg ??
« Reply #3 on: March 06, 2008, 02:50:31 PM »
nevermind, i'm an idiot, i see it.
thanks :)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: flipbrg ??
« Reply #4 on: March 06, 2008, 02:54:11 PM »
never mind, I'm an idiot

Sorry, that position is taken. Glad you figured it out.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: flipbrg ??
« Reply #5 on: March 06, 2008, 02:58:22 PM »
Alan,
Here is another that may interest you.
Code: [Select]
;;  CAB 10/04/2005
;;  Correct rotated dimension to reflect the current UCS
;;  Used when elevations are mirrored in a drawing
;;  Updates DXF code 51
(defun c:dimrot (/ d elst ang)
  (and
    (setq d (entsel))
    (setq elst (entget (car d)))
    (setq ang (- (* 2 pi)
                 (angle (trans '(0.0 0.0 0.0) 1 0)
                        (trans '(1.0 0.0 0.0) 1 0)
                 )
              )
    )
    ;;  prevent 2 * pi
    (if (equal ang (* 2 pi) 0.0001) (setq ang 0.0) t)
    (setq elst (subst (cons 51 ang) (assoc 51 elst) elst))
    (entmod elst)
  )
  (print ang)
  (princ)
)
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.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: flipbrg ??
« Reply #6 on: March 06, 2008, 03:24:36 PM »
very cool, thanks. however, the one i was interested in was the one that will change the bearing of N 00°00'00" E to S 00°00'00" W. it works (sort of), you can't have any any text in front or behind or it won't work properly. i had one that will do it (with preceding & trailing text) but it will also turn (S) into (N) and CURVE into CURVW, neither a huge deal, but it would be nice to find one that will work around this. i tried looking at the code with the intent of modifying it to work, but i just can't figure out how to have it exclude certain words.

here's the code in case someone wants it:

Code: [Select]
;TIP917: BFLOP.LSP (C)1993, PAUL S. JOHNSON
<edit by CAB>
Because the code is copyrighted we prefer a link to the code unless you
have permission to post the code.

Use this link to aquire the code:
http://new.cadalyst.com/code/browseyear.cfm?fullyear=1993
Goto December 1993
Look for Flop Line Bearings by Paul S. Johnson
« Last Edit: March 06, 2008, 05:03:25 PM by CAB »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: flipbrg ??
« Reply #7 on: March 06, 2008, 05:05:47 PM »
Would you post a sample DWG with the dimensions before & after?

Use the "Aditional Options" at the bottom of a New Post to attach the DWG.
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: flipbrg ??
« Reply #8 on: March 06, 2008, 05:29:55 PM »
Would something as simple as this work?
Code: [Select]
;;  Flips text to other side of Dim
;;  Updates DXF code 51
(defun c:dimFlopss (/ ss i ename elst ang)
  (princ "\nSelect Dim to Flip.")
  (setq ss (ssget '((0 . "DIMENSION"))))
  (setq i -1)
  (while (setq ename (ssname ss (setq i (1+ i))))
    (setq elst (entget ename))
    (setq ang (+ pi (cdr (assoc 51 elst))))
    (if (equal ang (* 2 pi) 0.0001) (setq ang 0.0));  prevent 2 * pi
    (setq elst (subst (cons 51 ang) (assoc 51 elst) elst))
    (entmod elst)
  )
  (princ)
)
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.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: flipbrg ??
« Reply #9 on: March 07, 2008, 08:15:25 AM »
sorry about posting his material, i thought that when a person makes a submission to cadalyst.com they are the proper owners now and they give the right to alter a routine as one sees fit. i must have been mistaken. again, i'm sorry.

cab, i'm not trying to rotate a "dimension" i'm trying to flip the bearing within mtext (static, etc. labels) (changing out N 00°00'00" E for S 00°00'00" W) and so on.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: flipbrg ??
« Reply #10 on: March 07, 2008, 09:35:29 AM »
I'm pretty weak when it come to Civil but if all you need is to swap the letters you can qualify the string
by using ( wcmatch str "*##@##'##\"*" ) which will be True for bearings.
Would that work or is there more text within the string to deal with?
Or is there some manipulation of the actual numbers needed?
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: flipbrg ??
« Reply #11 on: March 07, 2008, 09:43:31 AM »
As for posting the code, don't sweat it. 8-) Read this http://www.theswamp.org/index.php?topic=9202.0 about code.
I think Code from cadalyst.com is free to use but not to redistribute.
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: flipbrg ??
« Reply #12 on: March 07, 2008, 11:22:50 AM »
Here is a quickie.
Code: [Select]
;;  CAB 03.07.08
(defun c:BF (/ ent elst str idx chr1 chr2)
  (defun chrSwitch (str i / chr1 chr2)
    (setq i
           (apply 'min
                  (vl-remove nil
                             (mapcar '(lambda (x)
                                        (vl-string-position (ascii x) str (1+ i))
                                      )
                                     '("N" "S" "E" "W")))))
    (setq chr1 (substr str (1+ i) 1))
    (setq chr2 (cdr (assoc chr1
                           '(("N" . "S") ("S" . "N") ("E" . "W") ("W" . "E")))))
    (list chr1 chr2 i)
  )
  (setvar "cmdecho" 0)
  (cond
    ((not (setq ent (car (entsel "\nPick bearing to flop: "))))
     (princ "\nMissed, Try Again.")
    )
    ((and (setq elst (entget ent))
          (member (cdr (assoc 0 elst)) '("TEXT" "MTEXT"))
          (wcmatch (setq str (cdr (assoc 1 elst))) "*[NSEW ]##?##'##\"*")
     )

     (setq lst (chrSwitch str -1))
     (setq str (vl-string-subst (cadr lst) (car lst) str))


     (setq lst (chrSwitch str (caddr lst)))
     (setq str (vl-string-subst (cadr lst) (car lst) str (caddr lst)))

     (entmod (subst (cons 1 str) (assoc 1 elst) elst))
     (entupd ent)
    )
  )
  (princ)
)
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.

Bob Wahr

  • Guest
Re: flipbrg ??
« Reply #13 on: March 07, 2008, 11:42:27 AM »
<edit by CAB>
Because the code is copyrighted we prefer a link to the code unless you
have permission to post the code.
I think I just bit through my tongue.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: flipbrg ??
« Reply #14 on: March 07, 2008, 11:49:55 AM »
holy crap, that's brilliant!

the only issue i could find was that if you have

(S) CURVE DATA:
R=25.00'
D=25°00'00"
L=25.00'
Ch=25.00'
N 00°00'00" E

it will replace it with:

(N) CURVW DATA:
R=25.00'
D=25°00'00"
L=25.00'
Ch=25.00'
N 00°00'00" E

i guess it looks to the first N, S, E, W and changes that, is it possible to ignore certain strings of text?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox