Copy/paste or move and divide equally

how do you do this in Bricscad? I've tried the 2 different divide commands and i can't figure it out to make this easy or to make it work at all for that matter.
.... see my sketchup video
Grab entity, move/copy/paste and then when it gets to where I want it to, I add "/10" and it adds 10 entities in between the 2 initial ones divided equally.
Does that make any sense? help please

Comments

  • If you have the free Express Tools, you can use its COPYM command with the Divide option. Here's a custom version of it that inserts the D at the right time so that it works just like in Sketchup:

    Edited later: Lisp function (c:CD), or CopyDivide, code removed. It misused the (command) function to call what is probably a lisp function, and may have caused problems. See alternative lisp function (c:SAP) below, which does the same thing without calling ExpressTools' (c:CopyM) function.

  • @Anthony Apostolaros I will definitely try that. The array function works but I find it works from a corner to the same corner and then divide. If I want to grab for example the right corner of my aunt City but then put the left corner to the end of my line it won't work.
  • Omgaaaawwwd it work!!!! That was like my last command that I really wanted to be able to transfer as a scale from SketchUp to break scad. I believe I am fully immersed now
    ...lol thank you @Anthony Apostolaros
  • You can also do it with the ArrayPath command, but then you have to pick an entity instead of two points to represent the array path. But that's only one click instead of two, so if the line is already there it's easier. And it allows you to use other types of entities as the array path, not just lines. But with polylines, arcs, etc, there's also the question of whether to change the alignment of the items as the angle of the path object changes. And you have to type a lot of option letters to make this one work: AS, N, M, D, A, N, I.
    AS = ASsociative array
    N = No, not associative array
    M = Method to use in creating the array
    D = use Divide as the Method
    A = Align items tangent to the path object
    N = No, don't do that (though in some cases you might want to)
    I = number of Items in the array

    Here's a custom version that inserts all those letters in the right order so as to make it work like in Sketchup, except using a path object instead of the start and end points. I just wrote it, but it seems to be working so far:
    ; Sketchup-style Array command ; using path object instead of pick points (defun c:SA () (setq ss1 (ssget "Select objects to distribute along path: ")) (setq e1 (entsel " Select path object: ")) (setq x1 (getint " How many? ")) (command "arraypath" ss1 "" "" e1 "AS" "N" "M" "D" "A" "N" "I" x1 "X") )

    This one might be more reliable than the CopyDivide command above, since it's based on a built-in command. That other one is based on CopyM, which is already a variation on a built-in command.

  • @Anthony Apostolaros you are way smarter than me. I'll try the 2nd you sent but if one works I'll stick to that one, of not, I'll get confused. I'm just a designer, not an architect or engineer. Thanks a million
  • I would suggest using the second one, the SA command. You can rename it anything you want, of course. Whatever comes after the C: will be the command name.

    I just checked some lisp forum threads, and they all agreed that what I did in that CD or CopyDivide commmand is a bad idea. I called an ExpressTools lisp function in a (command) function, which is not what that function's intended for. And I shouldn't have called another lisp function without being able to see the other function's code.

  • ok will try.

  • Here's one that works exactly like CopyDivide above (i.e. like Sketchup), but without using ExpressTools. Only straight-line paths are allowed, and the path is specified by picking two points rather than by picking a path object.
    ; Sketchup-style Array by Points ; The ArrayPath command wants us to pick an object as the path. ; But we want to pick start and end points. ; So we'll draw the object, use it, and then delete it. (defun c:SAP () (setq ss1 (ssget "Select objects to distribute along path: ")) (setq p1 (getpoint " Base point of path: ")) (setq p2 (getpoint p1 " End point of path: ")) (setq x1 (getint " How many? ")) (command "line" p1 p2 "") (setq e1 (entlast)) (command "arraypath" ss1 "" "" e1 "AS" "N" "M" "D" "I" x1 "X") (command "erase" e1 "") )

  • How do you create these things and do I just paste it in?
  • To use any lisp function, copy the code and paste it into a text file. But change the filename extension from .txt to .lsp, like the attached file.

    Lisp files can be edited by Notepad, but there are also specialty text editors that help you keep track of all the parentheses. I use Notepad++, which is freeware.

    Then put a reference to that lisp file in your on_doc_load.lsp file, which should be in the Support sub-folder of your Bricscad program files folder. The reference is one line of that file, and it's just the (load) function with the path and filename, like this:
    (load "C:/Lisp Routines/SketchupArrayByPoints.lsp")

    Then every time you open a DWG file, that lisp function will be loaded automatically. So you'll be able to use the command whenever you want.

  • @Anthony Apostolaros, This is a great routine; one thing I noticed though, is if you select the entities first, then the dynamic dimensions don't show, so you can't lock it horizontally or to any of your preset polar angles.
    Please don't think I'm being picky :-)

  • Here's another variation, using the rotation feature. It looks like it might come in handy sometime, though maybe so rarely that it makes more sense to just use the ArrayPath command and figure out the option letters on the fly.
    ; Sketchup-style Array by Path Object with rotation ; This version accepts arcs, plines, etc, as the path object, ; and rotates the copies with the path object's changing slope. (defun c:SR () (setq ss1 (ssget "Select objects to distribute along path: ")) (setq e1 (entsel " Select path object: ")) (setq x1 (getint " How many? ")) (command "arraypath" ss1 "" "" e1 "AS" "N" "M" "D" "A" "Y" "I" x1 "X") )

  • Anthony Apostolaros
    edited February 2020

    @David Waight said:
    ..... if you select the entities first, then the dynamic dimensions don't show, so you can't lock it horizontally or to any of your preset polar angles.

    Sorry, but I don't know what dynamic dimensions are, and I don't know what it means to lock something horizontally or to lock something to preset polar angles. Maybe someone who knows about those things, and/or knows more about lisp, will know of a way to make them operate during the function.

    I know about ortho mode, which locks things in a sense, by constraining any vector that the user defines by non-osnap mouse click to one of the axes. Is that what you mean? I see now that this function pays no attention to ortho mode when picking the second point, with or without preselection. I'm surprised to see that, and I can't explain it.

  • It does work for me re: Ortho by pushing F8.
  • @Anthony Apostolaros , apologies I have had a bit more of a play with this routine and now realise what is happening.

    You can use existing snap points on the entitiy that you want to copy (or even snap points that are on an entity you don't want to copy) as the base point and the dynamic dimensions will show up, if however you pick an arbitrary point not on a snap point like you can with the copy command or move command etc. then the dynamic dimensions don't appear.

    Apologies if I didn't explain correctly the first time.

  • Anthony Apostolaros
    edited March 2020

    Ah, I think I understand now. I forgot to include the base point as a reference in the second (getpoint) function in the (c:SAP) function above. So there's no rubber-banding to the second pick point.

    And I remember now that when I first installed v17 there were dimensions included with the rubber-banding. That must be what dynamic dimensioning is.

    If so, all you have to do is add p1 as the first argument to the second (getpoint) function. I've edited the (c:SAP) function, above, to include that.

  • @Anthony Apostolaros Hey, how are you? hope you're keeping safe. So, I was using the copym and then hit D and put the number of copies I wanted between the 2 entities. It no longer works???? Am I doing something wrong or it's been removed?

  • @plabill said:
    .... I was using the copym and then hit D and put the number of copies I wanted between the 2 entities. ... Am I doing something wrong...?

    I'm guessing you actually hit D and then Enter or Space, because that's how command options normally work. But in this case you have to remember to leave out the Enter. Just D and then pick the second point. Then the number of copies, and then Enter twice.

    What about the custom SAP command above? No option letter needed. Just pick the base point, then the end point, then type the number of copies, then Enter. It's just like Sketchup, but without the Ctrl key or the /divide key. Since I wrote that I've completely stopped using CopyM.

  • Anthony Apostolaros
    edited March 2020

    @plabill said:
    ..... hope you're keeping safe. ...

    Yes, thank you. In fact, I'm driving less these days, since everything is closed or cancelled, and everyone else is driving less, so there's less chance of a car hitting my bicycle, so I'm probably a bit safer than usual. I just read that during the 15 weeks of the coronavirus crisis in China, 3,237 people there died from it. But during an average 15-week period in 2018, Wikipedia says there were 73,898 traffic deaths in China. If their car use decreased as much during the past 15 weeks as ours has in the past few days, the crisis may have saved more lives than it claimed.

  • @Anthony Apostolaros
    I saved your lsp as a lsp instead of txt on notepad as you indicated but it won't let me save into the support sub folder. System says I'm not authorized then it saves it into documents. Tried to move it without much success.
    I'd prefer to use your lsp instead of doing CopyM which works once every 30 times..
  • Anthony Apostolaros
    edited March 2020

    @plabill said:
    .....it won't let me save into the support sub folder. System says I'm not authorized then it saves it into documents. .....

    A Lisp file can be stored anywhere. You just have to keep track of where you saved it. It's only the on_doc_load.lsp file that actually has to be in the Support sub-folder of the program files folder, and it should already be there. Will your system let you edit that file?

    If not, I think you can use the APPLOAD command instead, which may in fact be easier. It opens a dialog that has a list of apps, a button to "Add application file," and check boxes to load each listed app one time or automatically whenever a dwg file is opened.

    Be sure to use the SAP function as it's posted now, not as originally posted without the p1 in the second getpoint function. And you can rename it anything you want instead of SAP.

  • Thank you so much for your assistance and patience. I'm not great with adding different things to an existing software. I'm now managing the software pretty well I think. I'm proud of myself LOL periods do you have the new full code with the p1. if I try to add it myself I'm sure I'll screw up and it's not going to work. So if I understand correctly once I saved it I can type sap in the code bar at the bottom and it will pop up?
  • @Anthony Apostolaros I saw this designed by a company in Australia I believe or the UK ?? and it inspired me to practice. I sent it to them they were very excited that they inspired me
  • Anthony Apostolaros
    edited March 2020

    @plabill said:
    .... do you have the new full code with the p1.

    Yes, I edited the post, so the way it's posted now has that correction.

    .... So if I understand correctly once I saved it I can type sap in the code bar at the bottom and it will pop up?

    Yes, once it's saved and loaded SAP will work the same way as LINE. If you use toolbars or pull-down menus, you can add it to those.

  • @Anthony Apostolaros omg omg omg omg.... it woooooorks… the lisp wooooorks!!!!
    Thank you thank you thank you. I managed to upload it following your instructions.
    Amazing. now i'll be using only that LOL

  • @Anthony Apostolaros doors bricscad know you're a genius?
  • Anthony Apostolaros
    edited March 2020

    All I did was add the option letters to a built-in command -- so that it works the way I want it to without any option letters. Ultra-elementary. The real lisp programmers didn't get involved because it's too simple for them.

    You can do that too, and since you like what lisp does you should try it. You can make any command work the way it works in Sketchup, or any other way you want. It's easier than it looks.

    You could start by analyzing the SAP function to see how it works. Look up each function in the online Developer Reference and see how it's supposed to work. The first word after opening parentheses is the function. Everything else inside those parentheses is the list of arguments to that function, as specified in the developer reference. Some of those arguments may be other functions. When functions are nested like that, the innermost function is evaluated first, the outermost one last. Instead of "lather, rinse, repeat" we say:
    (repeat (rinse (lather)))

    • or -
      (setq a (lather hair)) (setq b (rinse a)) (repeat b)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!