Jump to content
johnm1011

Deviation Autolisp command

Recommended Posts

johnm1011

Hello All,

I am new to this forum. I am working on an autolisp command and i have hit the wall and need a bit of assistance, so thanks in advance for the help. A brief background on what it is im trying to do - I work for a construction company that installs concrete piles in the ground which then have to be surveyed and that information has to be checked against the location the engineer has setup in the construction drawings interms of movement in the x,y, & z axis. The command i am trying to write would do the math by clicking on the center of the green circle (the engineers proposed location) and then the center of the red circle (the location the pile was actually installed). It would then insert those variables into an mtext entity. The issue i am coming up with is "too many arguments" and i can't figure out where the extra argument is in the command.

 

Those are the basics of what i want this command to do and here is what i ultimately want it to do (a wish list of sorts):

 

1- have the command know whether the "zdev" is positive or negative and add either "high" or "low" to the "zdev" part of the mtext entity.

2- have the center of the red circle be the insertion point

3- have the arrows that you see in the .dwg file insert themselves based upon whether the "xdev" and "ydev" are positive or negative.

 

If any one could point me in the right direction on any of these issues that would be awesome.

 

Thanks again,

John

 

Deviations.lsp

Deviation_INFO.dwg

Share this post


Link to post
Share on other sites
hmsilva

Hi John, and welcomed to CADTutor!

 

 

To comment an AUTO/Visuallisp code we must use a semicolon, and your code had some misplaced parenthesis...

Attached is your code, revised, and my interpretation of your code.

 

 

Hope that helps

Henrique

Deviation.LSP

Demo_.LSP

Edited by hmsilva
Correction of an attached file

Share this post


Link to post
Share on other sites
johnm1011

Henrique,

The revisions you mad to my LISP work great.

I tried your version but after i select the first circle as prompted the command ended and i'm not sure why. (If you could explain some of the coding that would be great... I learn things like this better when i can see them at work.

 

I would like to add a few more features to my LISP:

1)Can the negative symbol in the elevation deviation be suppressed.?

2)Can the "HIGH/LOW" be suppressed when the elevation deviation is zero when rounded to two decimal places "0.00"?

3)Can the center of the red circle - variable "PT2" be set as the insertion point of the mtext entity? (the project i am working on requires me to run this LISP almost 800 times and it would be a big help the have the mtext insert itself.

4)Can arrows be inserted as shown in the previously attached file so that they correlate to the direction in which the the red circle has moved in relation to the green circle. ie left=neg / right=positive / down=neg / up=positive.

 

Any insight and direction into coding these features would be awesome!

 

Thanks again,

John

Share this post


Link to post
Share on other sites
hmsilva

Hi John,

my 'demo' should work as expected, the code was written according your 'Deviation_INFO.dwg' and hardcoded that dwg layers.

 

The code prompts:

 

Select the proposed location circle: >

Select the actual location circle: >

Enter pile number: >

 

If you don't select an object, or don't enter an integer, the code will exit...

 

Try the code in your 'Deviation_INFO.dwg' and let me know if it works as expected ou not.

 

Regarding your last requests, only tonight I'll be able to modify your code, I'm out of office, and without AutoCAD.

 

 

Henrique

Share this post


Link to post
Share on other sites
johnm1011

Henrique,

I just figured out the what was happening. Your LISP works amazing. The hiccup was in that the circles in the drawings "green were part of a block and red is a cogo point" Is the cogo point an entity that can be selected do to the fact that i get the information as a COGO point and i can assign that red circle (which is a block) as the point style. Also is it possible to keep the green circles as a block and still be able to select the necessary circle.(More for drawing neatness than anything else "having 800 circles floating around is silly to me"

 

If you have an extra minute and would be willing to explain some of your coding that would be awesome.

 

As always Thank You!

 

John

Share this post


Link to post
Share on other sites
johnm1011

I just tried swapping "CIRCLE" for "COGO" that didn't work. Any ideas?

Share this post


Link to post
Share on other sites
hmsilva

John,

 

 

post a real sample dwg with some objects.

 

 

Henrique

Share this post


Link to post
Share on other sites
johnm1011

Henrique,

I have attached a .dwg with four COGO points and one block that has four green circles in it. A mini sample of what i'm doing.

 

Thanks,

John

COGO pts and blocks.dwg

Share this post


Link to post
Share on other sites
hmsilva

Ok john,

tonight, I'll see what I can do.

 

 

Henrique

Share this post


Link to post
Share on other sites
hmsilva

Demo_V1.LSP

1)Can the negative symbol in the elevation deviation be suppressed.?

2)Can the "HIGH/LOW" be suppressed when the elevation deviation is zero when rounded to two decimal places "0.00"?

3)Can the center of the red circle - variable "PT2" be set as the insertion point of the mtext entity? (the project i am working on requires me to run this LISP almost 800 times and it would be a big help the have the mtext insert itself.

4)Can arrows be inserted as shown in the previously attached file so that they correlate to the direction in which the the red circle has moved in relation to the green circle. ie left=neg / right=positive / down=neg / up=positive.

 

If you have an extra minute and would be willing to explain some of your coding that would be awesome.

 

John,

 

the attached code was revised to work with the 'COGO pts and blocks.dwg', expects the green circles as a block.

I did add some comments to the code.

 

Hope that helps

Henrique

Share this post


Link to post
Share on other sites
johnm1011

Henrique,

LISP works awesome. The only thing that is off is the order of the selection i need to be able to select the green circle "block" first then the red COGO point. I tried to rearrange myself but is was getting a "bad argument error message. Please help one more time!

 

Thanks

John

Share this post


Link to post
Share on other sites
hmsilva
The only thing that is off is the order of the selection i need to be able to select the green circle "block" first then the red COGO point. I tried to rearrange myself but is was getting a "bad argument error message.

 

You're welcome, John.

Done...

 

Henrique

Demo_V2.LSP

Share this post


Link to post
Share on other sites
johnm1011

Henrique,

Its perfect. Thank you, this will seriously shorten the time and more importantly the monotony of this part of my work.

 

John

Share this post


Link to post
Share on other sites
hmsilva

You're welcome, John

Glad I could help

 

Henrique

Share this post


Link to post
Share on other sites
johnm1011

Henrique,

Ran into a snag. I'm using civil 3d which reads the red circles as they are intended "cogo points" and it wont let me select the cogo point and kicks me out of the command. It worked flawlessly on my home computer with regular autocad. How can i solve this? can cogo opints be converted to acad proxy entities (not sure what they are)?

Share this post


Link to post
Share on other sites
hmsilva
Henrique,

Ran into a snag. I'm using civil 3d which reads the red circles as they are intended "cogo points" and it wont let me select the cogo point and kicks me out of the command. It worked flawlessly on my home computer with regular autocad. How can i solve this? can cogo opints be converted to acad proxy entities (not sure what they are)?

 

John,

unfortunately I'm not a C3D guy...

Hopefully someone with C3D can step in and assist.

 

Henrique

Share this post


Link to post
Share on other sites
hmsilva

John,

although not a C3D C3D guy, let's see if I can do something functional...

 

Copy /paste at command line

 

(dumpallproperties (car (entsel)))

 

select one of the cogo points, press F2 select the returned text, copy, open notepad paste the text, saveas .txt file and attach it...

 

Henrique

Edited by hmsilva

Share this post


Link to post
Share on other sites
hmsilva

John,

unfortunately dont helps...

Try with

(vlax-dump-object (vlax-ename->vla-object (car (entsel))) T)

 

And subst. the previous .txt

 

Henrique

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×