Results 1 to 7 of 7

Thread: Script / API to clean up “Line slightly off axis”

  1. #1
    I could stop if I wanted to brenehan's Avatar
    Join Date
    2007-02
    Location
    Melbourne
    Posts
    225

    Default Script / API to clean up “Line slightly off axis”

    As we progress, we are inevitably using Revit in replacement of where we use to use AutoCad. We are now even using Revit for some master planning.
    What this does mean, is we are having to use more and more AutoCAD (dwg) files in Revit. We need to be able to edit them and users want then in a Revit format, not just a linked dwg.
    So we endeavour to clean the dwg files up before we bring it into Revit with tools like “Overkill, Audit, Purge”, rationalize the layers and hatching, remove floating elements outside the drawing area and I also filter and remove short lines relative to the scale.
    What is more difficult is to fix lines that are 0.2 degrees off axis and 45 degrees, ie “Line slightly off axis” Currently I just have to import the file to Revit, explode and fix the errors. One of the last times I imported a file, I got 1300 lines slightly off axis. That is just too much to clean up.
    Is there anyway someone with programming knowledge can come up with an AutoCAD lisp routine or a Revit API to fix the lines with an error up. It would need to find lines that are 0.2 degrees off 0, 45 and 90 degrees. These lines would then be rotated from their centre axis no more than 0.1 degree to 0, 45 or 90 Degrees or the other way to 0.201 degree of 0, 45 or 90 degrees.
    I’ve looked for such a script without any luck. How difficult would it be to produce such a command?
    Thanks
    Brian
    Brian Renehan

    BIM Consultant
    Melbourne - Australia
    http://bimfix.blogspot.com

  2. #2
    I could stop if I wanted to brenehan's Avatar
    Join Date
    2007-02
    Location
    Melbourne
    Posts
    225

    Default Re: Script / API to clean up “Line slightly off axis”

    Quote Originally Posted by brenehan View Post
    Is there anyway someone with programming knowledge can come up with an AutoCAD lisp routine or a Revit API to fix the lines with an error up.
    Do you think this is possiable or just a pie in the sky wish?
    Brian Renehan

    BIM Consultant
    Melbourne - Australia
    http://bimfix.blogspot.com

  3. #3
    I could stop if I wanted to
    Join Date
    2004-05
    Location
    Auckland, New Zealand
    Posts
    340

    Default Re: Script / API to clean up “Line slightly off axis”

    Brian
    I don't think its a Pie in the Sky - In fact it should be a utility on the Import "Clean up Import File" We get heaps of slightly incorrect cad files & only at the last stages of documentation find out where the errors are.

  4. #4
    Revit Mararishi aaronrumple's Avatar
    Join Date
    2002-02
    Location
    St. Louis, MO
    Posts
    4,688

    Default Re: Script / API to clean up “Line slightly off axis”

    It would be a pretty simple routine to write in AutoCAD in either Lisp or VBA. It is just a matter of going through the collection of line and comparing the x,y coordinates of the endpoints of lines. You would just set a tolerance and compare. If they x values are within that tolerance, you would set then to the same value to square up lines. For angled lines you could do a similar check and set the correct x,y to give you a nice clean angle. The trick is picking a "good" value". You could add additional tests to see if any of the endpoints touch another line and then use that x,y as the control.

    Plines would be a bit more code, but the technique the same.

    However, this isn't going make sure the drawing is dimensionally correct - few AutoCAD drawings are.
    Don't drink the Kool-Aid...
    Aaron Rumple, AIA

  5. #5
    Active Member
    Join Date
    2006-05
    Location
    Northern VA
    Posts
    73

    Default Re: Script / API to clean up “Line slightly off axis”

    Having had to deal with this problem after the fact, I'd say make sure your AutoCAD drawing is drawn correctly. Since we know that won't happen, I'd say always check this out as soon as you link the file into Revit. Scripts and the like are above me but I'd be interested in a way to deal with something like this "automatically."
    Travis Vaughan, AIA, LEED AP
    Alexandria VA

  6. #6
    I could stop if I wanted to brenehan's Avatar
    Join Date
    2007-02
    Location
    Melbourne
    Posts
    225

    Default Re: Script / API to clean up “Line slightly off axis”

    Thanks Guys
    It’s good to know it’s possible. It’s the large scale maps we get (2 KM x 2 KM) that are the big headache. If you are just using them for master planning or just adjacent premises to your site, the fact some lines need to slightly rotated doesn’t really make any difference.
    It’s a bit of a contradiction in terms for us (CAD & BIM Managers) to insist users are creating clean Revit files with minimum error warnings and not give them the tools to clean up an AutoCAD file they need to import. In reality we could turn that right around to Autodesk. They have created the software that gives up the error warning, they have given us the software that generates the warning, but they haven’t given us the tools to fix it.
    So in the mean time, we (the users) will do, like we always do. The Users come up with a fix, and then wait for Autodesk to come out with something similar in the few years time.
    Does anyone, with the programming knowledge think they would be able and have time to write such a script and share it here?
    Thanks again.
    Brian
    Brian Renehan

    BIM Consultant
    Melbourne - Australia
    http://bimfix.blogspot.com

  7. #7
    AUGI Addict truevis's Avatar
    Join Date
    2004-07
    Location
    Massachusetts, USA
    Posts
    1,186

    Default Re: Script / API to clean up “Line slightly off axis”

    Here is a function I wrote in 1999 that identifies skewed lines. I haven't used it recently. I can be hired to customize it if anyone wants.
    Code:
    (defun c:skewedp  (/        txtset   total    test     ename
                       alist    test     update   next     fuzz-ask
                       ent-type)
      (defun update  (/ pt10 pt11 pt10x pt11x pt10y pt11y skewedp)
        (setq pt10  (cdr (assoc 10 alist))
              pt11  (cdr (assoc 11 alist))
              pt10x (nth 0 pt10)
              pt11x (nth 0 pt11)
              pt10y (nth 1 pt10)
              pt11y (nth 1 pt11))
        (print ename)
        (princ "Xs: ")
        (princ pt10x)
        (princ " ")
        (princ pt11x)
        (princ " Ys: ")
        (princ pt10y)
        (princ " ")
        (princ pt11y)
        (if (setq skewedp (or (and (equal pt10x pt11x fuzz)
                                   (not (equal pt10x pt11x fuzz2)))
                              (and (equal pt10y pt11y fuzz)
                                   (not (equal pt10y pt11y fuzz2)))))
          (redraw ename 3))
        (if skewedp
          (princ " Skewed!"))
        (setq test  (1+ test)
              ename (ssname txtset test))
        (if ename
          (setq alist (entget ename))))
      (defun next  ()
        (setq test  (1+ test)
              ename (ssname txtset test))
        (if ename
          (setq alist (entget ename))))
      (setq fuzz2 0.0000001)
      (if (not fuzz)
        (setq fuzz 0.2))
      (setq fuzz-ask (getdist (strcat "\nMaximum checking distance. <"
                                      (rtos fuzz)
                                      ">: ")))
      (if fuzz-ask
        (setq fuzz fuzz-ask))
      (prompt
        (strcat
          "\nLines will be highlighted if ends are different less than "
          (rtos fuzz 2 7)
          " and different more than "
          (rtos fuzz2 2 7)))
      (setq txtset (ssget)
            total  (sslength txtset)
            test   0
            ename  (ssname txtset 0))
      (if ename
        (setq alist (entget ename)))
      (while (< test total)
        (setq ent-type (cdr (assoc 0 alist)))
        (if (= "LINE" ent-type)
          (update)
          (next)))
      (princ))

Similar Threads

  1. slightly off axis
    By wadeshuey in forum Revit Architecture - General
    Replies: 0
    Last Post: 2010-09-21, 04:10 PM
  2. Slightly Off Axis
    By sthedens in forum Revit Architecture - General
    Replies: 4
    Last Post: 2010-08-12, 07:14 PM
  3. Correcting Lines which are slightly off the axis
    By harilalmn in forum VBA/COM Interop
    Replies: 2
    Last Post: 2009-02-05, 05:07 PM
  4. Error element is slightly off axis
    By sonya in forum Revit Architecture - General
    Replies: 5
    Last Post: 2007-06-07, 02:36 PM
  5. Numerous "slightly off-axis" warnings
    By patricks in forum Revit Architecture - General
    Replies: 6
    Last Post: 2006-07-27, 01:31 AM

Posting Permissions

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