Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enhanced Divide & Measure - Upgraded

17 REPLIES 17
Reply
Message 1 of 18
Kent1Cooper
1476 Views, 17 Replies

Enhanced Divide & Measure - Upgraded

DivideMeasurePlus.lsp has been upgraded!  For those who haven't seen it before, it contains "turbo-charged" versions of Divide and Measure, with significant enhancements over the ordinary AutoCAD commands [see descriptions in the top of the file].  Improvements in the attached, compared to the "previous release," include:

 

1.  By request from DARIOGOMEZPEREZ on this forum, the DIV+ command now has the option to inset the endmost Points or Blocks or Selection-set insertions by a User-specified distance from the ends of the selected path object.  It applies the Dividing operation to the remaining length between those inset locations.

2.  I figured one might want to use the same Block or Selection set in both commands.  In either of them, if you've named a Block in that command, that has always been offered as the default, and it now also offers the prior Selection set in the Selection option, if there is one.  But now, if you haven't yet chosen a Block or Selection in the command you're using, but you have done so in the other command, that other command's Block or Selection is offered as the default.

3.  In the Blocks option, if you haven't named a Block for either command yet, but ordinary Insert has a default Block name, that is offered.

4.  In the Blocks option, both commands formerly exited if you entered a Block name that was neither defined in the current drawing nor a Drawing in the Support File Search path(s).  Now they don't give up on you, but ask you again.

5.  In the Selection option, in either command, you can choose to use the prior Selection used in the command you're in, or the set used most recently in the other command, without needing to re-select anything.  [Choices are offered only for such Selections as have been established.]

 

...and a few other minor tweakings and streamlinings and avoidances of oddball problem situations.

Kent Cooper, AIA
17 REPLIES 17
Message 2 of 18
sachindkini
in reply to: Kent1Cooper

dear sir good lisp thx for sharing
Message 3 of 18

Thanks so much Kent!!

Message 4 of 18


@dariogomezperez wrote:

Thanks so much Kent!!


You're welcome.

 

Something occurred to me since that I want to ask about.  It wasn't quite clear to me, looking again at your initial question on the other thread, whether what you want is what I did -- inset the end ones and Divide the remaining length between those.  I thought perhaps you might have wanted something else -- Divide the overall length first, leave the typical ones spaced relative to the overall length, and inset the endmost ones from the ends [which would leave them closer to the next ones in than the typical ones are from each other].

 

If it was really the "something else" that you wanted, I expected you would write back and say it doesn't do what you need, so maybe I shouldn't wonder.  Anyway, I suppose the routine could have an option like that, but it seems unusual enough that I probably wouldn't want to write it in.  But you can achieve that result in a two-step process:

 

1.  Use DIV+ without the end points/insertions [or regular Divide if you don't need any of DIV+'s other enhancements];

2.  Then use DIV+ with end-insets, and "divide" the path object into one segment [something regular Divide won't do].

Kent Cooper, AIA
Message 5 of 18

Hey Kent, 

I see what you are saying. You did what I wanted the routine to do and I am not sure if I'd need the "something else" option but I can see how to do it if I were to need that.

I took a quick look at the code and it was a really nice way of solving the issue.

Again many thanks Kent!

 

Dario 

Message 6 of 18
3dwannab
in reply to: Kent1Cooper

Hi Kent,

I love this script but I was wondering if it's possible to divide the objects along a line taking into account the width of the block, object etc...

Basically if a block has a width of 50mm, I want to divide it along a line with equal spacing between the 50mm which can vary depending on what object. I find this will be handy for dividing objects with varying dimensions between opposing walls with perfectly equal spacing between. See attached screen-shot. Maybe this script has the functionality but I can't seem to find it.

Normally what I do is draw a line from one wall to the other. Stretch the line at each end by half the width of the object I want to divide and them use the standard divide command. If this is possible I would be forever grateful.

Thanks again.

Message 7 of 18
marko_ribar
in reply to: 3dwannab

Your posted image shows exactly how standard DIVIDE command operate... If blocks insertion points are centers of blocks, then when supplied number of divisions CAD will equaly distribute blocks with equal spacing between each one... That means distances would be D=EQ1+50/2 between each one of them... And this relation exactly corresponds to your posted picture (EQ1+50+EQ1+50+...+50+EQ1)

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 8 of 18
3dwannab
in reply to: marko_ribar

I'm not talking about the center of the 50mm. Please read the description of what I was wanting.

 

PS the image does not work how the standard divide command works. That's why I have to stretch the line either side by half the width of the object I want to array to distribute that object with even spaces between (not centered).

Message 9 of 18
devitg
in reply to: Kent1Cooper

A true DWG is better than a DWG , to get help.
Message 10 of 18
Kent1Cooper
in reply to: 3dwannab


@3dwannab wrote:

I'm not talking about the center of the 50mm. Please read the description of what I was wanting.

 

PS the image does not work how the standard divide command works. That's why I have to stretch the line either side by half the width of the object I want to array to distribute that object with even spaces between (not centered).


I agree that the image is not how regular Divide works [the distance between the ends of the Line and the first Block insertion point inward is not the same as the distance between Block insertion points, as Divide would do it].  I don't need a true .DWG to understand what you're after.

 

I have in mind to work that out, because I could use the same option myself sometimes.  Probably not in the next few days, though....  It would be a lot easier if the User could tell the routine how wide the Block is, but it may be possible to have it figure that out.

Kent Cooper, AIA
Message 11 of 18
3dwannab
in reply to: Kent1Cooper

Exactly, the same info in a drawing is what you would see in the screenshot. I'm not sure what the confusion was, I thought I was clear enough. Anyway thanks for trying to help Kent1Cooper. Personally, I won't mind entering in the values. But if you can make it work like that, then even better.

Message 12 of 18
november71
in reply to: Kent1Cooper

Hi Kent,

 

Without kissing your a$$ too much, this is a great lisp that saves me no end of time, so thanks very much for that.

 

Is is possible to select multiple lines and have the block applied to each of the selected lines with the same criteria? distance, scale, etc? And... also always add the same block to both ends of each line, not just the beginning?

 

As I said this lisp already save me LOADS of time but these additions would be the icing on a very nice cake

 

Thanks again.

Message 13 of 18
Kent1Cooper
in reply to: november71


@november71 wrote:

.... 

Is is possible to select multiple lines and have the block applied to each of the selected lines with the same criteria? distance, scale, etc? And... also always add the same block to both ends of each line, not just the beginning?

....


I can work on a multiple-selection option, but in the meantime, it does put them at both ends in DIV+, but not in MEA+ unless the overall length is exactly a multiple of the designated spacing.  If you mean to put them at both ends even in MEA+ without an exact-multiple length, that would be "in violation of" the nature of the command, since the spacing between two of them would be different than that between all the others.

Kent Cooper, AIA
Message 14 of 18
november71
in reply to: Kent1Cooper

Thanks for the quick reply.

 

Unfortunately (for me) the MEA+ is the more suitable part of the lisp. To have the ability to divide a long line into set (predetermined) lengths, say 1000mm, 2000mm, 3000mm etc and show the block at these preferred centres is ideal.

In this way I could determine the number of stock lengths to order to suit a particular line length, but importantly, have the block in its correct location, relative to the end of the line and therefore reflect the true detail that is being drawn / will be constructed.

If we use the DIV+ command although i achieve the correct quantity, the position of the block wouldnt be correct to the predetermined spacing required.

 

 

Message 15 of 18
Kent1Cooper
in reply to: november71


@november71 wrote:

.... To have the ability to divide a long line into set (predetermined) lengths..., but importantly, have the block in its correct location, relative to the end of the line .....

 


If I understand you correctly, I have a suggestion -- two steps, but not requiring any code modification.  Use either regular Measure or [if you want any of its greater possibilities] MEA+ without asking for one at the start of the path.  Then use DIV+ including putting them at the ends, but dividing it into one segment [regular Divide won't let you do that].

Kent Cooper, AIA
Message 16 of 18
november71
in reply to: Kent1Cooper

Hi, yes that works great, apart from the mutiple selection part of the request.

 

As far as i can see, you cant select muliple lines in the MEASURE command either?

Message 17 of 18
Kent1Cooper
in reply to: november71


@november71 wrote:

.... 

As far as i can see, you cant select muliple lines in the MEASURE command either?


That's right, nor in regular DIVIDE.  One big advantage that DIV+ and MEA+ have over those is that at least you can select multiple objects [albeit only one by one] in one running of the commands, and don't have to recall the command to do another with the same choices [not to mention that they also remember all your previous choices -- one of the main reasons I made them in the first place is that regular DIVIDE and MEASURE don't remember any defaults].

 

There are several other things about DivideMeasurePlus.lsp that I am already working on, including:

1)  In the mark-with-Lines option, whether the Line markers are centered on the path or project to the left or right;

2)  Having it display all current settings, and let the User choose only any of them that they want to change, so they don't need to step through and answer all those prompts every time, if they're going to be accepting the defaults for most of them.

 

I'll add multiple-object-selection-at-once to the list of possible alterations.  It would have one very slight drawback.  Currently, if you pick a path object that's too short for the command to do what it should, or if in DIV+ you ask it to "divide" into one segment but don't ask for markers at the ends, it lets you know that it can't do anything, but remains in the command.  With all-at-once multiple-object selection, it couldn't do that, but could presumably report when it's done whether there were any situations like that [and how many], which would probably be enough.

Kent Cooper, AIA
Message 18 of 18
november71
in reply to: Kent1Cooper

Sounds spot on Kent, I look forward to the next installment.

 

Thanks again for the original lisp.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost