See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Lisp to warn about international Feet

  1. #1
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Lisp to warn about international Feet

    Hi All,

    Just had a random thought while talking about coordinate systems with the co-workers. Would it be possible to create a routine that checks against international feet for either the drawing setting and/or the survey database in use? We never use it...ever.

    I don't think there's a way to code a routine to make sure we never make a coordinate system mistake ever, but since we never use international feet that'd be an easy one to snuff out. All I'd really want it to do is create some sort of alert pop-up that says your Drawing/Survey Database is in International feet.

    Thanks!

  2. #2
    I could stop if I wanted to
    Join Date
    2014-08
    Posts
    447
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    It seems to me the real problem would be importing some data from another source that is unknowingly in International feet

  3. #3
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    I don't think we've ever had that issue because I don't think we've ever received a CSV file from another company, and our surveyors never use international feet whenever we topo something.

    Even if we did though I've found that the best practice is always to check a couple CSV points against the imported points to confirm they haven't shifted slightly. One of my first topos I ever did back in the day resulted in me bringing in data in international feet when it was US Survey so everything shifted just enough to matter when they went out to stake it, but not enough to notice it in the drawing.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    1

    Default Re: Lisp to warn about international Feet

    Not quite sure that I understand what you're wanting to check.

    I get external surveys pretty frequently, and even when I get an in-house survey, my surveyor is still using AutoCAD 2000 + Eagle Point daily Haha, so all of his drawings open in International Feet (never really understood why, especially when I'm using Imperial, but WTFE).

    To know when 'something isn't right' in Civil 3D, I use 'Map Status' (MAPSTATUSBAR Command) to show me what coordinate system I'm working in for any given drawing, and to help expedite setting my desired coordinate system I wrote a lil' ditty for that too... Take from these what you like:

    Toggle Map Status
    Code:
    (vl-load-com)
    
    (defun c:MapStatus ()
      (command "._mapstatusbar"
               (if
                 (= 0
                    (vl-registry-read
                      (strcat
                        "HKEY_CURRENT_USER\\"
                        (if vlax-user-product-key                           ; If 2013+
                          (vlax-user-product-key)                           ; Use new function
                          (vlax-product-key)                                ; Use legacy function
                        )
                        "\\Applications\\AcMap"
                      )
                      "Statusbar"
                    )
                 )
                  "_s"
                  "_h"
               )
               ""
      )
      (princ)
    )
    Set Coordinate Zone
    Code:
    (vl-load-com)
    
    (defun c:SetCoordinateZone (/ vrsn acApp aeccApp aeccDoc aeccUnitsZone aeccCoordSys coord acDoc)
    
      (defun *error* (msg)
        (if aeccApp
          (vlax-release-object aeccApp)
        )
        (if acDoc
          (vla-endundomark acDoc)
        )
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      (if
        (and
          (setq vrsn
                 (if vlax-user-product-key                                  ; If 2013+
                   (vlax-user-product-key)                                  ; Use new function
                   (vlax-product-key)                                       ; Use legacy function
                 )
          )
          (setq vrsn
                 (cond
                   ((vl-string-search "21.0" vrsn) "11.0")                  ; 2017
                   ((vl-string-search "20.1" vrsn) "10.5")                  ; 2016
                   ((vl-string-search "20.0" vrsn) "10.4")                  ; 2015
                   ((vl-string-search "19.1" vrsn) "10.3")                  ; 2014
                   ((vl-string-search "19.0" vrsn) "10.0")                  ; 2013
                   ((vl-string-search "18.2" vrsn) "9.0")                   ; 2012
                   ((vl-string-search "18.1" vrsn) "8.0")                   ; 2011
                   ((vl-string-search "18.0" vrsn) "7.0")                   ; 2010
                   ((vl-string-search "17.2" vrsn) "6.0")                   ; 2009
                   ((vl-string-search "17.1" vrsn) "5.0")                   ; 2008
                   (T nil)
                 )
          )
          (setq aeccApp (vla-getinterfaceobject
                          (setq acApp (vlax-get-acad-object))
                          (strcat "AeccXUiLand.AeccApplication." vrsn)
                        )
          )
          (setq aeccDoc (vlax-get-property aeccApp "ActiveDocument"))
          (setq aeccUnitsZone
                 (vlax-get
                   (vlax-get (vlax-get aeccDoc 'settings) 'drawingsettings)
                   'unitzonesettings
                 )
          )
          (setq aeccCoordSys
                 (vlax-get
                   (vlax-get
                     (vlax-get (vlax-get aeccDoc 'settings) 'drawingsettings)
                     'unitzonesettings
                   )
                   'coordinatesystem
                 )
          )
          (setq coord "FL83-WF")
          (princ "\nWorking, please wait... ")
          (princ)
        )
         (progn
           (vla-startundomark
             (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
           )
           (vlax-put aeccUnitsZone 'angularunits 1)
           (if (= 1.0 (vlax-get aeccUnitsZone 'drawingscale))
             (vlax-put aeccUnitsZone 'drawingscale 20.0)
           )
           (vlax-put aeccUnitsZone 'drawingunits 1)
           (vlax-put aeccUnitsZone 'foottometerconversionflag 2)
           (vlax-put aeccUnitsZone 'matchautocadvariables 0)
           (vlax-put aeccUnitsZone 'scaleobjectsfromotherdrawings 0)
           (vlax-put aeccCoordSys 'cscode coord)
           (princ "Done. \n")
         )
      )
    
      (*error* nil)
    )


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    Thanks Blackbox,

    Not quite sure that I understand what you're wanting to check.
    Yeah, sorry I wasn't quite clear. In my haste I worded it a bit incorrectly.

    When setting your drawing settings you don't have to worry about international feet. In the Database (see attached) you can set it to international US Survey Feet, or Meters. specifically when the user forgets to set the Coordinate Zone in their database when they create it. It's not common, but every now and then something seems to happen where down the road someone realizes a drawing's points aren't importing/exporting correctly, and by the time everything is said and done someone screwed up the coordinate system in some way shape or form where ultimately the original drawing creator didn't do their due diligence to make sure everything was proper with the drawing.

    So here's two revised questions

    1) Is it possible for a Lisp routine, when you open a database for edit, to alert the user if it's not in US Foot?
    2) Is it possible for a Lisp routine, when your database and drawing settings do not match, to alert the user that they do not match?

    The bottom line to my inquiry in this thread is if there is simply an additional layer of QA/QC that could reasonably be added because correcting this type of stuff can be time-consuming depending on how it went down.

    Thanks!
    Attached Images Attached Images

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    Quote Originally Posted by CCarleton View Post
    Yeah, sorry I wasn't quite clear. In my haste I worded it a bit incorrectly.

    When setting your drawing settings you don't have to worry about international feet. In the Database (see attached) you can set it to international US Survey Feet, or Meters. specifically when the user forgets to set the Coordinate Zone in their database when they create it. It's not common, but every now and then something seems to happen where down the road someone realizes a drawing's points aren't importing/exporting correctly, and by the time everything is said and done someone screwed up the coordinate system in some way shape or form where ultimately the original drawing creator didn't do their due diligence to make sure everything was proper with the drawing.

    So here's two revised questions

    1) Is it possible for a Lisp routine, when you open a database for edit, to alert the user if it's not in US Foot?
    2) Is it possible for a Lisp routine, when your database and drawing settings do not match, to alert the user that they do not match?

    The bottom line to my inquiry in this thread is if there is simply an additional layer of QA/QC that could reasonably be added because correcting this type of stuff can be time-consuming depending on how it went down.
    No worries, thanks for clarifying.

    I'm confident that there is, have an idea of how to go about it but will need to get back to you with a LISP Reactor (.NET Event Handler?) for this, as I don't use Survey Databases for my work (perhaps you can post a sample 'problem' and 'good' DB for me to test with?)

    That, and I'm currently on vacation today (hooray, me!), so will need to revisit this in +/- an hour when my chair on the patio is no longer in sun (I give Mrs. BB the good chair, that gets another hour or so) Haha


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    Sounds good Blackbox, I will drop some examples here for you in the near future to further explain what I am looking for.

    Thanks for all your help, have a good vacation!

    Cheers!

  8. #8
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    Ok, here we go.

    -Scratch the International Feet aspect of this. Making people aware that their database and drawing coordinate systems don’t match is all we need to accomplish.
    -I have attached a DWG and a Database to this post.
    -As an added FYI the coordinate Systems we use are NAD83 LDP Iowa Regional Zone 1 thru NAD83 LDP Iowa Regional Zone 14. Not sure if that’s necessary info or not.

    The Drawing is in
    Categories: USA, Iowa
    Available Coordinate Systems: NAD83 LDP Iowa zone 10

    The Database is in
    Coordinate zone: NAD83 LDP Iowa zone 14
    Distance: US Foot

    All Iowa Zones are in US Foot so I don’t think you need to worry about it the Distance Category. Again, I think we can scrap worrying specifically about international feet and just have the routine check against the Coordinate Zones between the DWG and the Database and report back if they are not the same.

    -When a user runs the "open database for edit" the routine checks the Database’s Coordinate System against the Drawing’s Coordinate System. If they are the same it does nothing. If it sees that the Database Setting and the Drawing settings are different it pops up an alert stating that the Drawing Setting is in X coordinate zone and the Database is in Y Coordinate zone

    Example
    “NOTICE: The Database’s Coordinate System you just opened for edit does not match the current Drawing’s Coordinate System.
    Drawing’s Coordinate System: NAD83 LDP Iowa Regional Zone 4
    Database’s Coordinate System: NAD83 LDP Iowa Regional Zone 5”

    -Extra Credit Internet Points: If you import a CSV into a Drawing with a Database whose Coordinate System does not match the Drawing’s it notifies the user restating the settings did not match.

    Example
    “NOTICE: Your Drawing and Database Coordinate Systems did not match on your recent CSV file import. You should confirm that your points have imported into the correct spot.
    Drawing’s Coordinate System: NAD83 LDP Iowa Regional Zone 10
    Database’s Coordinate System: No Datum, No Projection"

    I think this will get me what I need accomplished.

    Thanks for all your help Blackbox! No real rush on this, so enjoy your vacation!

    Thanks!
    Attached Files Attached Files
    Last edited by CCarleton; 2017-04-14 at 08:30 PM.

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    It's taken me a while to revisit this; an engineer left for another position, and I've been swamped.


    In any event, please find an Autoloader .bundle attached that supports Civil 3D 2015-2018; simply download, unblock, and extract to your %AppData%\Autodesk\ApplicationPlugins folder.

    I've taken the liberty of revising some of the verbiage used in the notifications, in order to be consistent with what the properties are called within Civil 3D (which are not consistent by design?); that way, user can easily identify which property they may need to change, etc. in order to make Drawing and Survey Settings the same.

    The app is entirely event-driven once loaded. User is notified when they open a Survey Database, and if the Drawing and Survey Settings match (or do not match, obviously), as well as when user switches to another drawing (just in case).


    I haven't had a chance to look at the CSV Import task yet, and not sure when I will have time; hope this is useful nonetheless.


    Cheers
    Attached Files Attached Files
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    306
    Login to Give a bone
    0

    Default Re: Lisp to warn about international Feet

    Blackbox,

    Thanks for the update and taking the time to do this. Couple of things:

    Did you mean to say ProgramData instead of Appdata? There is an ApplicationPlugins folder directly under ProgramData, and I can see a couple other apps there (We use CloudWorx from Leica). I am on a computer that uses active directory if that matters on where I store it/how my computer tries to interact with plugin files. There is an ApplicationPlugins folder under the roaming section of Appdata as well, but nothing local/locallow.

    Alas, I do not seem to be getting the bundle to load regardless of where I drop it. I believe I should be getting a prompt about CAD detecting an unknown application trying to run when I first start CAD (I don't have these locations set to a trusted path), but that doesn't happen. I have tried opening databases and checking to see if the program is doing something when I open a database or change coordinate systems. I assume I should get some sort of pop-up if it was functioning, but I have been checking my command line for anything and am not seeing anything. I attached a couple images to show you what I am talking about.

    I initially tried here: C:\ProgramData\Autodesk\ApplicationPlugins

    As you can see in the second image it extracted a folder called "Contents" with a support subfolder that contains two .dll files. Beside the "Contents" folder is a packagecontents.xml. I installed this same folder in the roaming section of the ApplicationPlugins of the appdata folder.

    Thanks for all your help Blackbox!

    Edit: Of course after I post this I do the thing where I get it to load properly. I created another folder called "Blackbox.bundle" and placed the "Contents" folder and the PackageContexts.xml file in it. It then prompted me on starting up AutoCAD that it found an executable file. I have told it to always load it, but I do not see the package actually working. Knowing my luck I will figure that out shortly after posting this, but I had been testing (before I got it to warn me about the file load) with crazy datums from other countries and then opening a sandbox database set to Iowa South, US Foot, but did not get a pop-up or see anything in command line. Now that I have told it to load I am still not seeing anything when I open a database in a different coordinate system from drawing settings.

    Thanks!
    Attached Images Attached Images
    Last edited by CCarleton; 2017-05-30 at 07:54 PM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Warn before upgrading
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2015-11-13, 02:09 AM
  2. 2013: BOM Occurance Base Unit in Square Feet instead of Linear Feet or Each
    By darrell.badger in forum Inventor - General
    Replies: 0
    Last Post: 2013-07-01, 10:28 PM
  3. 2010: US Feet
    By elsabrosoweb in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2013-06-14, 08:20 PM

Posting Permissions

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