I need a routine that inserts a point at the insert point or block named "Insert_Point" at every block in the file. The routine could use the current layer, which would be set prior to starting the routine. If it could request the user for the PDMode value and PDSize that would be great too. This will assist me in creating block libraries. Thanks in advance.
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
You should be able to pull what you need from this thread:
"How we think determines what we do, and what we do determines what we get."
Many years ago, before AutoDesk Design Center was born, I had been using a routine named BLOCKMAN. It creates image for blocks in a library and put a red cross at the insert point in the image.
@Anonymous wrote:I need a routine that inserts a point at the insert point or block named "Insert_Point" at every block in the file. The routine could use the current layer, which would be set prior to starting the routine. If it could request the user for the PDMode value and PDSize that would be great too. This will assist me in creating block libraries. Thanks in advance.
randy,
to insert a point at the insertion point at every blocks in the file,
perhaps something like this
(defun c:test (/ ent itm num pdm pds ss) (if (setq ss (ssget "_X" '((0 . "INSERT")))) (progn (while (= (member pdm '(0 1 2 3 4 32 33 34 35 36 64 65 66 67 68 96 97 98 99 100)) nil) (setq pdm (getint (strcat "\Enter new value for PDMODE <"(rtos (getvar "pdmode"))">: "))) (if (null pdm) (setq pdm (getvar "pdmode")) );; if (if (= (member pdm '(0 1 2 3 4 32 33 34 35 36 64 65 66 67 68 96 97 98 99 100)) nil) (progn (prompt "\nRequires one of these values: 0,1,2,3,4,32,33,34,35,36,64,65,66,67,68,96,97,98,99 or 100.\n") (setq pdm nil) );; progn );; if );; while (setq pds (getint (strcat "\Enter new value for PDSIZE <"(rtos (getvar "pdsize"))">: "))) (if (null pds) (setq pds (getvar "pdsize")) ) ;; if (setvar "pdmode" pdm) (setvar "pdsize" pds) (setq itm 0 num (sslength ss) ) (while (< itm num) (setq ent (entget (ssname ss itm))) (if (/= (logand 4 (cdr (assoc 70 (tblsearch "block" (cdr (assoc 2 ent))))))4) (progn (entmakex (list (cons 0 "POINT") (cons 10 (cdr (assoc 10 ent))) (cons 410 (cdr (assoc 410 ent))) ) ) );; progn );; if (setq itm (1+ itm)) );; while );; progn );; if );; test
hope that helps
Henrique
I saw BlockMan going to $95 bucks. Is this the one you previously used?
Henrique, I'll give your routine a try on Monday.
@ Henrique
There is no need to reconstruct the same dxf code two times .
This ...
(cons 410 (cdr (assoc 410 ent)))
is enough with this .
(assoc 410 ent)
@Anonymous wrote:I need a routine that inserts a point at the insert point or block named "Insert_Point" at every block in the file. The routine could use the current layer, which would be set prior to starting the routine. If it could request the user for the PDMode value and PDSize that would be great too. This will assist me in creating block libraries. Thanks in advance.
Not sure, but why not incorporate the "point" entitiy on the block
(defun C:adp (/ ss a) (command "_ddptype") (if (setq ss (ssget '((0 . "INSERT")))) (repeat (setq i (sslength ss)) (if (not (member (setq bn (Vla-get-effectivename (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ) ) data ) ) (vla-addpoint (vlax-ename->vla-object (cdr (assoc 330 (entget (tblobjname "BLOCK" bn))) ) ) (vlax-3D-point 0 0) ) ) ) ) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports ) )
(if (not (member bn data)) (progn (setq data (cons bn data)) (vla-addpoint .......
Out of offense , The above part was missing
Although applying the point to the block sounds good in theory, it problematic in practice. There are various design reasons why a user may have to display points by their style in their design file. I wouldn't want their design points to interfere with the point in a block. Good thinking out of the box though.
Tharwat, exactly where do I put those additional code line?
@Anonymous wrote:Tharwat, exactly where do I put those additional code line?
All creadit goes to pbejse
(defun c:test (/ ss i bn lst) (or doc (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ) (command "_ddptype") (if (setq ss (ssget '((0 . "INSERT")))) (repeat (setq i (sslength ss)) (if (not (member (setq bn (Vla-get-effectivename (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ) ) lst ) ) (progn (setq lst (cons bn lst)) (vla-addpoint (vla-item (vla-get-blocks doc) bn) (vlax-3D-point 0 0) ) ) ) ) ) (vla-regen doc acAllViewports ) (princ) ) (vl-load-com)