Automate alert when coordinates are not good

Automate alert when coordinates are not good

yu85.info
Collaborator Collaborator
726 Views
10 Replies
Message 1 of 11

Automate alert when coordinates are not good

yu85.info
Collaborator
Collaborator

Hi, I have a drawing (DWG attached) it has the wrong coordinates because who draws it replace the X Y. It happens often in my office and it takes time to repair it (there are blocks and etc that get bad when it happens).

Is there a way to activate an automatic alert when the coordinates of the drawing are misplaced?
The rule it that the X coordinates always start with the number 1.... or 2.... and Y always with 6.... or 7....
can it be done to create a massage whenever the X coordinates of the drawing goes to 6/7 on X and 1/2 on Y?
Thanks very much for your kindly help/

0 Likes
727 Views
10 Replies
Replies (10)
Message 2 of 11

Kent1Cooper
Consultant
Consultant

That seems a very odd standard to me, but since I don't know what kinds of things you're drawing....

 

This will warn the User simply if the X coordinate of the middle of the extents of the drawn contents is greater than the Y coordinate.  That will alert you in the wrong situation you describe, and not in the right situation, without having to dig into the specific numbers, and will also cover a wider range of conditions:

 

(setq extmid (mapcar '/ (mapcar '+ (getvar 'extmax) (getvar 'extmin)) '(2 2 2)))
(if (> (car extmid) (cadr extmid)) (alert "Check for XY reversal."))

 

It could also give an alert that the XY relationship is correct, if desired.

 

It could be made to check specifically for the range of values in each, if that's really needed.  If so, are things always in the 6-digit range in both directions as in the drawing?  In other words, it's not just the first digit that matters, but the entire value?

 

That could be put into the definition of a command that you would need to run to check, or it could be set up to check every time you open any drawing.  Your description sounds like you're hoping for something to constantly monitor the relationship, and catch a change like that when it happens.  I don't know of a way to do that, but there may be one.

Kent Cooper, AIA
Message 3 of 11

yu85.info
Collaborator
Collaborator

Thanks for your help. The only rule is that the x coordinates must be smaller then the y coordinates. That will cover all the mistakes.

I need it to check the drawing automatically  after a specific command i am using : _NTCL_BlockfromExcel.
This command is an app that insert blocks from excel table that contains X Y Z columns/

Thanks again
 

0 Likes
Message 4 of 11

Kent1Cooper
Consultant
Consultant

@yu85.info wrote:

.... I need it to check the drawing automatically after a specific command i am using : _NTCL_BlockfromExcel.....


Do you have the code defining that command?  If so, you could just add the test/alert at the end of it.

Kent Cooper, AIA
0 Likes
Message 5 of 11

yu85.info
Collaborator
Collaborator
Thank you but i purchased the app as a subscription so i think i do not
have permission to edit the code.
I understand that it is a difficult problem to create the alert as a
separate automatically validation alert.
0 Likes
Message 6 of 11

john.uhden
Mentor
Mentor

@yu85.info ,

It's probably not that difficult to avert.

As each line of the XLS (or CSV) is read, just simply reverse the X and Y values if X>Y.

But that requires changing the code, specifically for you since other licensees may not have your problem.

The only thing that we could do for you would be to pre-check the file and fix it when Xs are > Ys.

Please tell us that it's a CSV and not an XLS.

John F. Uhden

Message 7 of 11

Sea-Haven
Mentor
Mentor

Like John can read the Excel from CAD and add a new Excel sheet with values swapped if that is ok, but that is definitely a beer money task. A macro in Excel would be easier.

Message 8 of 11

Kent1Cooper
Consultant
Consultant

@yu85.info wrote:
... i purchased the app as a subscription so i think i do not have permission to edit the code. ....

Is it an AutoLisp routine that can be run with (C:_NTCL_BlockfromExcel)?  If so, can you combine it with a test command?

 

(defun C:WHATEVER ()

  (C:_NTCL_BlockfromExcel)

  (.... the test and maybe the alert ...)

)

Kent Cooper, AIA
0 Likes
Message 9 of 11

yu85.info
Collaborator
Collaborator

Eventually I asked the guy who wrote the code to make the adjustment. Cost a few bucks but I hope it is worth it.

Thank you for your response.

0 Likes
Message 10 of 11

john.uhden
Mentor
Mentor

@yu85.info and @Kent1Cooper ,

Ya know this is an issue that DCA->Softdesk->Land Desktop saw coming... that civils often prefer to see coordinates as N,E which equals Y,X.  So they provided choices for interpreting a file's format.  Your coder should take heed of that and provide you improved code for free (unless maybe if it cost you only $100 in the first place).  Just my opinion since for a while I tried licensing my own add-ons.  The customer is [almost] always right.  I remember spending many hours modifying one of my programs to handle one client's excessively long strings of parcel IDs.  But he was thrilled, and that's what you want a client to be.

John F. Uhden

0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

Like John look at CIV3D has all sorts of combos and you can make your own, PXYZD, PXY, PYX and so on.

0 Likes