jakebullet70 Posted March 27, 2009 Share Posted March 27, 2009 Its me again... (aCad 2007) I am trying to use VBA to draw a line with a text block and am looking for the best way to do that. I am using: Dim obj As AcadLine Set obj = ThisDrawing.ModelSpace.AddLine(vPoint1, vPoint2) And this does in fact draw a line. But if you look at the image I have uploaded. The line needs to resemble the top line, the one that is high lighted with the arrows and has the text block on top. So I guess the question is: How do I get the arrows? Or can I save the existing line and text block (they can be moved around together) and just reload that? That seems like a good idea but I have not figured how to save it. Or am I missing the boat again? Again, thanks. Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted March 27, 2009 Share Posted March 27, 2009 I have code for this, brb Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted March 27, 2009 Share Posted March 27, 2009 (defun c:dimarr (/ ent entname entguts pt1 pt2 ang revang objtype) (setvar "cmdecho" 0) (setq layname nil) (setq ent T) (while ent (setq ent (entsel) entname (car ent) entguts (entget entname) objtype (cdr (assoc 0 entguts)) ) (if (= objtype "LINE") (progn (setq pt1 (cdr (assoc 10 entguts)) pt2 (cdr (assoc 11 entguts)) ang (angle pt1 pt2) revang (angle pt2 pt1) sf (getvar "dimscale") clay (getvar "clayer") entguts (subst (cons 8 clay) (assoc 8 entguts) entguts ) ) (entmod entguts) (command "-insert" "arrow" pt1 sf sf (r->d revang)) (setq entname (entlast) entguts (entget entname) entguts (subst (cons 8 clay) (assoc 8 entguts) entguts ) ) (entmod entguts) (command "-insert" "arrow" pt2 sf sf (r->d ang)) (setq entname (entlast) entguts (entget entname) entguts (subst (cons 8 clay) (assoc 8 entguts) entguts ) ) (entmod entguts) ) (command "explode" ent "") ) ) (setvar "cmdecho" 1) (princ) ) Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted March 27, 2009 Share Posted March 27, 2009 That is a lsp solution, that should point you in the right direction. If not, let me know and I will help you convert it Quote Link to comment Share on other sites More sharing options...
jakebullet70 Posted April 1, 2009 Author Share Posted April 1, 2009 Sorry, I got tossed a different set of tasks for the week. Hope to re-visit this again next week before I forget everything I have learned about Acad in the last few weeks. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 1, 2009 Share Posted April 1, 2009 Looks like its missing a sub-function Cmdrduh - the radian to degree convertor by the looks of it. Just thought i'd give ya the heads up Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 1, 2009 Share Posted April 1, 2009 Just add this to it Jake: (defun r->d (ang) (* 180 (/ ang pi))) Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted April 1, 2009 Share Posted April 1, 2009 Thanks! I wrote that code years ago, and didn't really proof it before posting Quote Link to comment Share on other sites More sharing options...
jakebullet70 Posted April 3, 2009 Author Share Posted April 3, 2009 Well, of course... they changed the specs on me. hehehe. Anyway. I have been given a drawing to insert now. I can use my VBA code and insert it and have added a text block so I can put the text I need What I am trying to do now is resize the left and right sides. I know the total length so that is not a problem I have included the drawing. Any help would be appreciated! Thanks a bunch guys and gals!!! ChairDim.dwg Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.