Programming for block insertion at selected point then trimming the line between the block.
*^c^cattdia;0;^c^c_.insert;BALL-VALVE;\;1;\;;^C(setq edata (entget (setq en (entlast))));^c^cbreak;\f;(setq edata (entget (entnext (cdr (assoc -1 edata)))))(setq ip1 (cdr (assoc 10 edata)));(setq edata (entget (entnext (cdr (assoc -1 edata)))))(setq ip1 (cdr (assoc 10 edata)));^c^cattdia;1;^cSo, let's jump into this and dissect this code some.
*^c^cattdia;0;
This bit of code tells the program to not display an attribute dialog box after placing a block. If you do want it to show just change 0 to 1.
^c^c_.insert;BALL-VALVE;\;1;\;;
Obviously this is the command for insert and then calling out the block that we are wanting to insert, but the thing that you will need to notice on this is the semicolons at the end. Even though we told the program that we didn't want to display an attribute dialog box you still have to account for the attributes attached to the block with a return command. So, the last 2 semicolons are representing the 2 attributes attached to the block that is being inserted.
;^C(setq edata (entget (setq en (entlast))));
This snippet of coding is telling the program to find the data from the last inserted block.
^c^cbreak;\f;
Now, we start the break command and then tell it that we want to do a fence break "f".
(setq edata (entget (entnext (cdr (assoc -1 edata)))))
Here we are telling the program to find the first attribute point which we inserted one at each end of the block being inserted.
(setq ip1 (cdr (assoc 10 edata)));
Once we have told it to find the first attribute point we then insert the code to enter in the actual coordinate points for the first point of the fence break.
(setq edata (entget (entnext (cdr (assoc -1 edata)))))
Then we repeat the process for the second attribute point.
(setq ip1 (cdr (assoc 10 edata)));^c^cattdia;1;^c
Enter this in again for the second attribute points to be passed to the break command and complete the 2-point fence break command.
And the finished product is an inserted block with line that it is attached to properly trimmed to fit the block.
No comments:
Post a Comment