Jump to content

Help Understanding a Lisp Routine


drew4748

Recommended Posts

Recently I had a lisp routine made up by another member. It creates an array like pattern which searches for attributes located in each panel and patterns the blocks accordingly. This typically couldn't be completed using just the array command as the spacing changes between areas.

 

It does exactly what it is programmed to do, however I would like to make a few changes and am unsure as to how to go about this. I understand the following part of the code allows me to change the y value, which I have done numerous times, however I cannot find out where to change the x value. I have tired adding an x value (similar to how the y value is added) with no success.

(list x_pointer (+ 49.0 y_value)) 1.0 1.0 0.0)

 

I also am wondering where in the code the routine grabs the spacing from. It appears the routine is grabbing the spacing from the next area, not the area the block is currently in. Is there a way to change this? I have attached a picture of the CAD which shows the difference. In the top way the first spacing is actually the spacing of the next area, not the area it is in. The only way around this is to trick it by adding 2 areas of the same value in a row, which will then increase the number of ballast blocks.

 

If anyone can point me in the right direction on how to change this I would be very thankful.

 

ballast.lsp

Capture2.jpg

Link to comment
Share on other sites

A drawing showing before and after processing of the routine will help us to maybe try to improve it...

 

Yes, I guess that would be much more helpful. Sorry about that. As you can see the blue zone has less spacing than the yellow zone. To get fist spacing of the blocks correct, 2 yellow zones have to be added, which makes me come to the conclusion that the routine is grabbing spacing of the next colour zone. Please let me know if you need anything else.

 

test 2 (after).dwg

test 2 (before).dwg

Link to comment
Share on other sites

Your blocks (before) drawing have wrong attributes specifications...

If there is 1 ballast, then attribute has to hold only 1 value of spacing between X coordinate of insertion point of block and X coordinate of ballast block insertion point...

If there are 2 or more ballasts in a row in single block, then attribute has to hold 2 or more spacing distances between X coordinate of block and X coordinate of 1st ballast, and then spacing between 1st ballast and next ballast (2nd), and so on... Or alternatively spacings between X coordinate of block and X coordinate of each insertion points of each ballast...

 

So according to your (after) drawing :

1. Lower left block :

- spacing : 0.0

- back : 0.0,510.0

2. Lower right block :

- spacing : 147.0

- back : 7.0,920.0 (between ballasts) or 927.0 (clean spacing between block and 2nd ballast)

3. Upper left block :

- spacing : 0.0

- back : 0.0,760.0

4. Upper right block :

- spacing : 427.0

- back : 507.0

Link to comment
Share on other sites

Your blocks (before) drawing have wrong attributes specifications...

If there is 1 ballast, then attribute has to hold only 1 value of spacing between X coordinate of insertion point of block and X coordinate of ballast block insertion point...

If there are 2 or more ballasts in a row in single block, then attribute has to hold 2 or more spacing distances between X coordinate of block and X coordinate of 1st ballast, and then spacing between 1st ballast and next ballast (2nd), and so on... Or alternatively spacings between X coordinate of block and X coordinate of each insertion points of each ballast...

 

So according to your (after) drawing :

1. Lower left block :

- spacing : 0.0

- back : 0.0,510.0

2. Lower right block :

- spacing : 147.0

- back : 7.0,920.0 (between ballasts) or 927.0 (clean spacing between block and 2nd ballast)

3. Upper left block :

- spacing : 0.0

- back : 0.0,760.0

4. Upper right block :

- spacing : 427.0

- back : 507.0

 

So would this be an issue with how I am setting it up? It seems like it works and spaces the blocks exactly as the value of the attribute is programmed, just it grabs the spacing of the area the ballast block is going into, not the area it is currently in. How would I change this?

 

Also where would I change starting x value point; I typically do all the blocks using this routine, then grab them all and move them over to the appropriate cantilever.

 

Sorry if I am misunderstanding what you said, I just thought I was starting to understand it, but now I am not so sure haha.

Link to comment
Share on other sites

I think that the routine "ballast.lsp" is only working correctly according to specifications of attributes of blocks by pure luck... With my advise, you wouldn't have to have not understandable code, you would have to insert ballasts according to each block no matter where in array of selection it occurs...

 

IMHO, this mod. would save you a lot of trouble and you'll be sure that you have correct result...

Link to comment
Share on other sites

I think that the routine "ballast.lsp" is only working correctly according to specifications of attributes of blocks by pure luck... With my advise, you wouldn't have to have not understandable code, you would have to insert ballasts according to each block no matter where in array of selection it occurs...

 

IMHO, this mod. would save you a lot of trouble and you'll be sure that you have correct result...

 

So how would I go about modifying this to produce the correct result.

Link to comment
Share on other sites

So how would I go about modifying this to produce the correct result.

 

So i ended up fixing the issue as to why it was "grabbing" the spacing from the next zone, a block was behind my colouring zones which somehow was throwing off the spacing. Now my next question is how can I move the insertion point over rather than the lower left corner of the colouring zone.

Link to comment
Share on other sites

I am glad you solved the issue, but I would do it differently like I described...:)

 

As for changing blocks base point, you have this solved on Lee Mac's website...

http://www.lee-mac.com/changeblockinsertion.html

 

Regards...

 

Sorry I dont think I was very clear. I want to change the insertion point of the lsp routine. I know how to do the y value, however I cannot figure out how to do the x value.

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...