Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/14/2020 in all areas

  1. It would be quicker to save the points to a list checking for duplicates using the equal function with a fuzz factor. This should also cover any sub mm problems, but you would have to go into a bit more detail as to what that problem is. Convert coords to strings as you write the csv file. IIRC, the insert command on the command line,infact any command, assumes everything is a string then converts what it needs back into the required integer, real, list etc. This is what makes "command" in a lisp 6-10 times slower. Creating entities with entmake is the fastest, followed closely by the vl add methods, vlax-invoke ??? and vla-add??? in that order. Vla-add is slightly slower as it again has some overheads. I'm the other side of the world so i'll post a few pointer in the later today.
    1 point
  2. A question to Sambo why would you put a BLOCK with att "STN" to 10,000 points ? Are you sure your data file does not have more that your not telling us. If so let us know now, not when you ask for further enhancements after code is posted. You can do a multisort of a list using Vl-sort for x y z etc. Is this what your Bubblesort does, for those oldies like me if you goggle bubblesort its a sorting method been around for ever, prior to Vl-sort I wrote a lisp bubblesort about 30 years ago.
    1 point
  3. This is not tested since I don't know what PointsList is, so idk if this will work or fail, but I do know that my sub function will work. Seeing as how I analysed your code, maybe this will do the trick. Hopefully it works... <Again, this is not tested> vla-insertblock normally takes time, but idk how else entmake will create the attributes... I'm not that skilled (defun c:putblocks ( / atts blk blkname blkpath msp pointslist) (setq msp (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))) blkpath "L:\\Work\\SUR\\LIBRARY\\AutoCAD Civil 3D\\General Settings\\LISP\\Point Management\\Pointblock.dwg" ; <-- the full filepath of the block to insert blkname (vl-filename-base blkpath) ) (JH:InsertBlockToDrawing blkpath) (foreach x PointsList ; <--- Your points list here please (setq blk (vla-InsertBlock msp (vlax-3d-point x) blkname 1.0 1.0 1.0 0.0)) (if (setq atts (vlax-invoke blk 'GetAttributes)) (vla-put-TextString (car atts) "STN") ) ) (princ) ) ;; JH:InsertBlockToDrawing --> Jonathan Handojo ;; Inserts a written block into a drawing if it hasn't already been inserted ;; path - the full filepath of the block to be inserted (defun JH:InsertBlockToDrawing (path / *error* layobj stt tmp) (defun *error* (msg) (if tmp (entmod (subst (cons 70 stt) tmp (entget layobj))))) (if (null (tblsearch "block" (vl-filename-base path))) (progn (if (/= 0 (setq stt (cdr (assoc 70 (entget (setq layobj (tblobjname "layer" (getvar 'clayer)))))))) (entmod (subst (setq tmp '(70 . 0)) (assoc 70 (entget layobj)) (entget layobj) ) ) ) (vla-delete (vla-InsertBlock (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-3d-point 0 0 0) path 1.0 1.0 1.0 0.0 ) ) (if tmp (entmod (subst (cons 70 stt) tmp (entget layobj) ) ) ) ) ) )
    1 point
×
×
  • Create New...