Jump to content

Deviation Autolisp command


johnm1011

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • hmsilva

    12

  • johnm1011

    12

Top Posters In This Topic

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
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

John,

unfortunately dont helps...

Try with

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

 

And subst. the previous .txt

 

Henrique

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...