Jump to content

Need better multiline


Vigilante

Recommended Posts

Hey that's great!

 

As far as my needs go, the Arc feature is not necessary. The arcs you draw automatically are fine. Only the arc is a bit wide, it doesn't have to be so big.

 

You can also remove the Length option, because it seems you can just type a length as you are drawing, without having to use that option. And this works fine. But when I DO use the Length option, it changes the length of the previous segment, not the one I'm currently setting. So I don't need that specifically.

 

I'm only saying to remove them so that the code can stay smaller and simpler and not get to complex with features and extra clicking.

 

So there are three things I'd want to change:

 

1) There is no need to specify the 'start width' for making the transitions between duct sizes. You can just assume that the start width is the same as the previous duct width. So in other words, while you draw, and use the Width option, it only needs to ask for the new width, and then you can do the transition with the previous width as the start width. If that makes sense. That would eliminate an extra click, because I'll never change the start width.

 

2) Make the corner arcs a little tighter. This lets the turns and segment lengths get shorter around corners. Sometimes I have to make pretty tight corners, and if it is to close, your program can't make the arcs.

 

3) Allow ESC and space both to be used to end the command. If I draw duct for a while and press escape, it looses everything. This is bad habit on my part, because Multiline let you press escape, so sometimes I press esc instead of space and loose what I've drawn. So please allow ESC!

 

Other than that, you can keep the code simpler by not having the Length and Arc features.

 

I hope I don't sound picky, I'm just trying to streamline the command so that it has only what I need, and nothing I don't, so there is as few clicks as possible, and less complexity. Remember KISS!

 

You are awesome! Thanks!

Link to comment
Share on other sites

Call me a perfectionist.

 

The idea is to have a very specific command without any unnecessary features that may not be used. It is so very close to perfection! lol

Link to comment
Share on other sites

I know it. But it's a one of a kind script.

My boss said this is the holy grail of LISPs, they've been dreaming about a duct script like this for years.

 

Seriously, once it's complete, he could sell it. I'd put it up on hotscripts or wherever, and set up a paypal to charge a little, I think it would be worth it.

 

I hope I'm not asking to much, that's why I said to remove the halfwidth, arc, and length commands, so he doesn't have to spend time perfecting them. Just stick with the basics. Removing the asking for "start width" should make it simpler. I figured changing the arc radius is just popping in a new number, I dunno.

 

It's very good though, I'm very grateful!

Link to comment
Share on other sites

I know he could sell it. i told him that in a PM when i thanked him for the Lisp as well. and before you do anything to his program, i'd ask permission if i were you, beings that he's the author.

 

and if you and your boss wants it so bad, why not send him some $$$? especially if you're asking for more and more custom changes, which in my persional opinion you're asking WAY too much here; but hey, he wrote it and not me so i guess it doesn't matter. :)

Link to comment
Share on other sites

Greetings friends. To me is what to tell, but absolutely there is no time. We shall return to discussion on holidays.

 

It is necessary to not admit that my chief has killed me, before he will be killed by the customer. :o

Link to comment
Share on other sites

I would send him a few bucks, if he has paypal. And if the script is the way I need it :)

 

It's kind of a hard thing. Because if the script isn't removing the necessary steps, I might as well keep using multiline. But actually the script is more than usable right now, I'm just talking about removing the rough edges.

 

It's only about 300 lines of code. Heck, I've written scripts up to a thousand lines or so for free over forums in VB and PHP and other languages I know. I just wish I knew LISP.

 

ASMI is the bomb diggidy for doing this!

 

And if he can't work on it anymore, I hope, as I learn LISP, to go and edit it myself if that's OK with him?

Link to comment
Share on other sites

so what if i asked you to make a custom script for my website in PHP? 300 lines of code is all i would need, then after you do it, i'll have all these demands on how you should change it for me, all on your time. and i'll ask not once, but a few times... and you'll be okay with that? lol.... i doubt it.

 

admitting that you're a man of code, common sense would tell me you would go about this differently. just my $0.02

 

8)

Link to comment
Share on other sites

Maybe, maybe not.

If I've signed up on a forum where people need help with my specific area of expertise, I guess I would, by default, set myself up to program for people or edit their scripts.

 

Maybe you think different. But if I can help somebody create the perfect solution to their problem, their joy is my payment. But as is with ASMI, the problem is time. I don't write 300 line scripts for people all in a night, I just fiddle with it when I can.

I'm a member of another forum where I've got 2200 posts or so of helping people with computer problems. It takes time, there is no payment, I just like helping people and using my knowledge for their benefit.

 

I am very grateful for his working on the script, make no mistake. And if he has paypal, I wouldn't be against sending him a few bucks. But payment was never part of the deal from the beginning, so I can't exactly pay him $90 an hour. And he doesn't seem to object to perfecting the script. What use is a half-baked script anyway? Once it is complete, I imagine it will be very useful to anybody who draws ducting like we do.

 

Have a nice day

Link to comment
Share on other sites

lol, draws ducting like "we" do? don't make me laugh. i'm in the same business - HVAC - and already me and my guys are using his script, taking MEGA time off our work load. granted, it's not "perfect" to our needs but it sure does do the job, and a lot better than we were having to do before. we're a big company too, me and the 5 other full time drafters here don't seem to have a problem with ASMI's script..... :)

Link to comment
Share on other sites

Ya, the script works fine, I know, I'm using it too. But there is no need for some of the extra features, I'm trying to tell him that he doesn't have to put MORE time into it making these features if they aren't necessary. In fact he can remove them to make the code smaller and quicker.

 

Simplify simplify simplify!

Link to comment
Share on other sites

Now with correct radiuses for all corners. It was necessary to remember secondary school, namely the 'law of sines' and the 'law of cosines'. In the first program I simply made _offset and it was not necessary to think of it. Excuse that so long - it was necessary to alter urgently one project.

 

(defun c:dpipe(/ actDoc ang1 ang2 ang3 ptLst enDist
       fPt lEnt lObj lPln oldVars oldWd
       plEnd plStart1 plStart2 prDir
       segLst Start stDist stLst tAng
       vlaPln *error*)
 
 (vl-load-com)

 (defun GetPlineVer(plObj)
   (mapcar 'cdr
    (vl-remove-if-not
     '(lambda(x)(=(car x)10))
     (entget plObj)))
   ); end of GetPLineVer

 (defun asmi-PlineSegmentDataList(plObj / cLst outLst)
  (setq cLst
   (vl-remove-if-not
     '(lambda(x)(member(car x) '(10 40 41 42)))
     (entget plObj))
  	 outLst '()
   ); end setq
 (while cLst
   (if(assoc 40 cLst)
     (progn
      (setq outLst
     (append outLst
      (list
	(list
	  (cdr(assoc 10 cLst))
	  (cdr(assoc 40 cLst))
	  (cdr(assoc 41 cLst))
	  (cdr(assoc 42 cLst))
	 ); end list
); end list
     ); end if
); end setq
      (repeat 4
(setq cLst(cdr cLst))
); end repeat
      ); end progn
     (setq outLst
     (append outLst
     (list
       (list
 	(cdr(assoc 10 cLst))
	); end list
       ); end list
    ); end append
   cLst nil
   ); end setq
     ); end if
   ); end while
 outLst
   ); end of asmi-GetPlineSegmentData


 (defun asmi-LayersUnlock(/ restLst)
 (setq restLst '())
 (vlax-for lay
   (vla-get-Layers
            (vla-get-ActiveDocument
              (vlax-get-acad-object)))
   (setq restLst
    (append restLst
      (list
        (list
         lay
          (vla-get-Lock lay)
  (vla-get-Freeze lay)
         ); end list
        ); end list
      ); end append
   ); end setq
   (vla-put-Lock lay :vlax-false)
   (if
     (vl-catch-all-error-p
(vl-catch-all-apply
 'vla-put-Freeze(list lay :vlax-false)))
     t)
   ); end vlax-for
 restLst
 ); end of asmi-LayersUnlock

 (defun asmi-LayersStateRestore(StateList)
 (foreach lay StateList
   (vla-put-Lock(car lay)(cadr lay))
    (if
     (vl-catch-all-error-p
(vl-catch-all-apply
 'vla-put-Freeze(list(car lay)(nth 2 lay))))
     t)
   ); end foreach
 (princ)
    ); end of asmi-LayersStateRestore

 (defun PipeMLineStyle(/ dxfLst mlDict)
 (setq dxfLst
  (list'(0 . "MLINESTYLE")'(102 . "{ACAD_REACTORS")'(102 . "}")
   '(100 . "AcDbMlineStyle") '(2 . "DUCT_PIPE")
   '(70 . 272)'(3 . "")'(62 . 256)'(51 . 1.5708)'(52 . 1.5708)
   '(71 . 2)'(49 . 0.5)'(62 . 256)'(6 . "BYBLOCK")
   '(49 . -0.5)'(62 . 256)'(6 . "BYBLOCK"))); end setq
   (if
    (null
     (member
      (assoc 2 dxfLst)
        (dictsearch
  (namedobjdict)
  "ACAD_MLINESTYLE")))
   (progn
     (setq mlDict
      (cdr
        (assoc -1
  (dictsearch
    (namedobjdict)
    "ACAD_MLINESTYLE"))))
     (dictadd mlDict
        (cdr(assoc 2 dxfLst))(entmakex dxfLst))
     ); end progn
   ); end if
); end of PipeMLineStyle

(defun SideCalculate(Rad Ang)
 (setq Ang(- pi Ang))
 (*
   (/
     (sqrt(-(* 2(expt Rad 2))(* 2(expt Rad 2)(cos Ang))))
     (sin(- pi Ang)))(sin(/(- pi(- pi Ang))2)
    )
   )
 ); end of SideCalculate

 (defun *error*(msg)
   (setvar "CMDECHO" 0)
   (if lObj
     (command "_.erase"(entnext lObj)"")
     (command "_.erase"(entlast)"")
     ); end if
   (if oldVars
     (mapcar 'setvar
     '("FILLMODE" "PLINEWID" "CMDECHO" "OSMODE")
     oldVars); end mapcar
    ); end if
   (if stLst
     (asmi-LayersStateRestore stLst)
     ); end if
    (if actDoc
     (vla-EndUndoMark actDoc)
     ); end if
   (princ "*Cancel* ")
   (princ)
   ); end of *error*

 (PipeMLineStyle)
 
 (if(not dpipepWd)(setq dpipepWd 1.0))
 (setq oldWd dpipepWd
       dpipepWd(getdist
              (strcat "\nSpecify first segment width <" (rtos dpipepWd) ">: "))
oldVars(mapcar 'getvar '("FILLMODE" "PLINEWID" "CMDECHO" "OSMODE"))
       ); end setq
 (if(null dpipepWd)(setq dpipepWd oldWd))
 (mapcar 'setvar
 '("FILLMODE" "PLINEWID" "CMDECHO")
 (list 0 dpipepWd 1)); end mapcar
 (if(entlast)(setq lObj(entlast)))
 (vla-StartUndoMark
  (setq actDoc
   (vla-get-ActiveDocument
     (vlax-get-acad-object))))
  (setq fPt
 (getpoint "\nSpecify start point: ")
    ); end setq
 (command "_.pline" fPt)
 (while(= 1(getvar "CMDACTIVE"))
   (command pause)
   ); end while
 (if
   (not
     (equal lObj(entlast)))
(progn
 (setq lEnt(entlast)
       stLst(asmi-LayersUnlock)
 	segLst(asmi-PlineSegmentDataList lEnt)
 	vlaPln(vlax-ename->vla-object lEnt)
 ); end setq
 (setvar "OSMODE" 0)
 (setvar "CMDECHO" 0)
 (while (/= 1(length segLst))
      (setq stDist
      (vlax-curve-getDistAtPoint vlaPln
	(caar segLst))
     enDist
      (vlax-curve-getDistAtPoint vlaPln
	(caadr segLst))
     ); end setq
   (if(< 2(length segLst))
     (progn
      (setq ang1
      (+(/ pi 2)(angle(caar segLst)(caadr segLst)))
     ang2
      (+(/ pi 2)(angle(caadr segLst)(car(nth 2 segLst))))
     ); end setq
      ); end progn
     ); end if
   (if
     (or
(not Start)
prDir
);end or
      (setq plStart1
       (vlax-curve-getPointAtDist vlaPln
	 stDist)
     Start T); end setq
      (setq plStart1
       (vlax-curve-getPointAtDist vlaPln
	 (+ stDist(SideCalculate(cadar segLst)ang3)))); end setq
     ); end if
     (if(and ang1 ang2)
     (progn
     (if(> ang1 ang2)
 (setq ang3(- ang1 ang2))
 (setq ang3(- ang2 ang1))
 ); end if
      (setq ang3(- pi ang3)
     tAng ang3)
      (if(minusp ang3)(setq ang3(- ang3)))
      ); end progn
     ); end if

   (if
     (or
       (equal ang1 ang2 0.000001)
(= 2(length segLst))
      ); end or
     	  (setq plEnd
           (vlax-curve-getPointAtDist vlaPln
	   enDist)
	prDir T); end setq
         (setq plEnd
           (vlax-curve-getPointAtDist vlaPln
	    (- enDist(SideCalculate(cadar segLst)ang3)))
	prDir nil); end setq
     ); end if
   (if
     (< 2(length segLst))
      (setq plStart2
       (vlax-curve-getPointAtDist vlaPln
	 (+ enDist(SideCalculate(cadar segLst)ang3)))); end setq
     ); end if
      (if(< 2(length segLst))
       (if
	 (=(cadar segLst)(nth 2(car segLst)))
	  (setq ptLst
                    (mapcar
	      '(lambda(x)(trans x 0 1)); end lambda
                (list(polar plEnd ang1 (/(cadar segLst)2))
		     (polar plEnd (+ pi ang1)(/(cadar segLst)2))
		     (polar plStart2 (+ pi ang2)(/(cadar segLst)2))
		     (polar plStart2 ang2 (/(cadar segLst)2))
	      	); end list
	          ); end mapcar
		); end setq
	 (setq ptLst
	   (mapcar
	    '(lambda(x)(trans x 0 1)); end lambda
	       (list (polar plStart1 ang1 (/(cadar segLst)2))
		     (polar plStart1 (+ pi ang1)(/(cadar segLst)2))
		     (polar(caadr segLst)(+ pi ang2)(/(nth 2(car segLst))2))
		     (polar(caadr segLst)ang2(/(nth 2(car segLst))2))
		     ); end list
	          ); end mapcar
		); end setq
       ); end if
 ); end if
     (setq plStart1(trans plStart1 0 1)
      plEnd(trans plEnd 0 1)
  ); end setq
   	(if plStart2
     		(setq plStart2(trans plStart1 0 1))
     	); end if
      (if
 (and
   (< 2(length segLst))
  (or
      (not(equal ang1 ang2 0.000001))
      (/=(cadar segLst)(nth 2(car segLst)))
    ); end or
   ); end and
      (progn
       	(setvar "PLINEWID" 0.0)
       	(command "_.pline")
	(mapcar 'command ptLst)(command "_c")
       	(setvar "PLINEWID" dpipepWd)
); end progn
 ); end if
   (if
     (and
       (not(equal ang1 ang2 0.000001))
       (< 2(length segLst))
     ); end and
     (progn
      	(setq lPln
      (vlax-ename->vla-object(entlast))
      tAng(- ang2 ang1)
     ); end setq
       (if(minusp tAng)(setq tAng(- tAng)))
        (if
	  (and
	   (< 0 tAng)
	   (>= pi tAng)
	   ); end and
	 (progn
       		(vla-SetBulge lPln 1 (/(- ang2 ang1)4))
       		(vla-SetBulge lPln 3 (/(- ang1 ang2)4))
         ); end progn
	 (progn
	   (if(< ang1 ang2)
	     (setq ang1(+ ang1 pi)
		   ang2(- ang2 pi)); end setq
	     (setq ang1(- ang1 pi)
		   ang2(+ ang2 pi)); end setq
	     ); end if
	   	(vla-SetBulge lPln 1 (/(- ang2 ang1)4))
       		(vla-SetBulge lPln 3 (/(- ang1 ang2)4))
	   ); end progn
	 ); end if
      ); end progn
 ); end if
 (if
   (=(cadar segLst)(nth 2(car segLst)))
   	 (command "_.mline" "_st" "DUCT_PIPE"
	"_S" (cadar segLst) "_J" "_Z"
	plStart1 plEnd "")
   ); end if
   
   (setq segLst(cdr segLst)); end setq
   ); end while
 (command "_.erase" lEnt "")
 (asmi-LayersStateRestore stLst)
 ); end progn
   ); end if
 (vla-EndUndoMark actDoc)
(mapcar 'setvar
     '("FILLMODE" "PLINEWID" "CMDECHO" "OSMODE")
     oldVars); end apply
 (princ)
 ); end of c:dpipe 

dp3.png

Link to comment
Share on other sites

Great lips work there, ASMI.

 

Vigilante and Stykeface, can we keep the banter down on this thread and keep on topic. i think its developed into a great thread, one that has not been seen for a while [ brings back memories of Fuccaro's lisp's years ago :D]

 

G

Link to comment
Share on other sites

I have executed some wishes of Vigilante. Now it is possible to not enter width each time and a pipe remains by pressing Esc.

 

(defun c:dpipe(/ actDoc ang1 ang2 ang3 ptLst enDist
       fPt lEnt lObj lPln oldVars oldWd
       plEnd plStart1 plStart2 prDir
       segLst Start stDist stLst tAng
       vlaPln cFlg *error*)
 
 (vl-load-com)

 (defun GetPlineVer(plObj)
   (mapcar 'cdr
    (vl-remove-if-not
     '(lambda(x)(=(car x)10))
     (entget plObj)))
   ); end of GetPLineVer

 (defun asmi-PlineSegmentDataList(plObj / cLst outLst)
  (setq cLst
   (vl-remove-if-not
     '(lambda(x)(member(car x) '(10 40 41 42)))
     (entget plObj))
  	 outLst '()
   ); end setq
 (while cLst
   (if(assoc 40 cLst)
     (progn
      (setq outLst
     (append outLst
      (list
	(list
	  (cdr(assoc 10 cLst))
	  (cdr(assoc 40 cLst))
	  (cdr(assoc 41 cLst))
	  (cdr(assoc 42 cLst))
	 ); end list
); end list
     ); end if
); end setq
      (repeat 4
(setq cLst(cdr cLst))
); end repeat
      ); end progn
     (setq outLst
     (append outLst
     (list
       (list
 	(cdr(assoc 10 cLst))
	); end list
       ); end list
    ); end append
   cLst nil
   ); end setq
     ); end if
   ); end while
 outLst
   ); end of asmi-GetPlineSegmentData


 (defun asmi-LayersUnlock(/ restLst)
 (setq restLst '())
 (vlax-for lay
   (vla-get-Layers
            (vla-get-ActiveDocument
              (vlax-get-acad-object)))
   (setq restLst
    (append restLst
      (list
        (list
         lay
          (vla-get-Lock lay)
  (vla-get-Freeze lay)
         ); end list
        ); end list
      ); end append
   ); end setq
   (vla-put-Lock lay :vlax-false)
   (if
     (vl-catch-all-error-p
(vl-catch-all-apply
 'vla-put-Freeze(list lay :vlax-false)))
     t)
   ); end vlax-for
 restLst
 ); end of asmi-LayersUnlock

 (defun asmi-LayersStateRestore(StateList)
 (foreach lay StateList
   (vla-put-Lock(car lay)(cadr lay))
    (if
     (vl-catch-all-error-p
(vl-catch-all-apply
 'vla-put-Freeze(list(car lay)(nth 2 lay))))
     t)
   ); end foreach
 (princ)
    ); end of asmi-LayersStateRestore

 (defun PipeMLineStyle(/ dxfLst mlDict)
 (setq dxfLst
  (list'(0 . "MLINESTYLE")'(102 . "{ACAD_REACTORS")'(102 . "}")
   '(100 . "AcDbMlineStyle") '(2 . "DUCT_PIPE")
   '(70 . 272)'(3 . "")'(62 . 256)'(51 . 1.5708)'(52 . 1.5708)
   '(71 . 2)'(49 . 0.5)'(62 . 256)'(6 . "BYBLOCK")
   '(49 . -0.5)'(62 . 256)'(6 . "BYBLOCK"))); end setq
   (if
    (null
     (member
      (assoc 2 dxfLst)
        (dictsearch
  (namedobjdict)
  "ACAD_MLINESTYLE")))
   (progn
     (setq mlDict
      (cdr
        (assoc -1
  (dictsearch
    (namedobjdict)
    "ACAD_MLINESTYLE"))))
     (dictadd mlDict
        (cdr(assoc 2 dxfLst))(entmakex dxfLst))
     ); end progn
   ); end if
); end of PipeMLineStyle

(defun SideCalculate(Rad Ang)
 (setq Ang(- pi Ang))
 (*
   (/
     (sqrt(-(* 2(expt Rad 2))(* 2(expt Rad 2)(cos Ang))))
     (sin(- pi Ang)))(sin(/(- pi(- pi Ang))2)
    )
   )
 ); end of SideCalculate


 (defun BodyFunction()
 (if
   (not
     (equal lObj(entlast)))
(progn
 (setq lEnt(entlast)
       stLst(asmi-LayersUnlock)
 	segLst(asmi-PlineSegmentDataList lEnt)
 	vlaPln(vlax-ename->vla-object lEnt)
 ); end setq
 (setvar "OSMODE" 0)
 (setvar "CMDECHO" 0)
 (while (/= 1(length segLst))
      (setq stDist
      (vlax-curve-getDistAtPoint vlaPln
	(caar segLst))
     enDist
      (vlax-curve-getDistAtPoint vlaPln
	(caadr segLst))
     ); end setq
   (if(< 2(length segLst))
     (progn
      (setq ang1
      (+(/ pi 2)(angle(caar segLst)(caadr segLst)))
     ang2
      (+(/ pi 2)(angle(caadr segLst)(car(nth 2 segLst))))
     ); end setq
      ); end progn
     ); end if
   (if
     (or
(not Start)
prDir
);end or
      (setq plStart1
       (vlax-curve-getPointAtDist vlaPln
	 stDist)
     Start T); end setq
      (setq plStart1
       (vlax-curve-getPointAtDist vlaPln
	 (+ stDist(SideCalculate(cadar segLst)ang3)))); end setq
     ); end if
   (if(and ang1 ang2)
     (progn
     (if(> ang1 ang2)
 (setq ang3(- ang1 ang2))
 (setq ang3(- ang2 ang1))
 ); end if
      (setq ang3(- pi ang3)
     tAng ang3)
      (if(minusp ang3)(setq ang3(- ang3)))
      ); end progn
     ); end if

   (if
     (or
       (equal ang1 ang2 0.000001)
(= 2(length segLst))
      ); end or
     	  (setq plEnd
           (vlax-curve-getPointAtDist vlaPln
	   enDist)
	prDir T); end setq
         (setq plEnd
           (vlax-curve-getPointAtDist vlaPln
	    (- enDist(SideCalculate(cadar segLst)ang3)))
	prDir nil); end setq
     ); end if
   (if
     (< 2(length segLst))
      (setq plStart2
       (vlax-curve-getPointAtDist vlaPln
	 (+ enDist(SideCalculate(cadar segLst)ang3)))); end setq
     ); end if
      (if(< 2(length segLst))
       (if
	 (=(cadar segLst)(nth 2(car segLst)))
	  (setq ptLst
                    (mapcar
	      '(lambda(x)(trans x 0 1)); end lambda
                (list(polar plEnd ang1 (/(cadar segLst)2))
		     (polar plEnd (+ pi ang1)(/(cadar segLst)2))
		     (polar plStart2 (+ pi ang2)(/(cadar segLst)2))
		     (polar plStart2 ang2 (/(cadar segLst)2))
	      	); end list
	          ); end mapcar
		); end setq
	 (setq ptLst
	   (mapcar
	    '(lambda(x)(trans x 0 1)); end lambda
	       (list (polar plStart1 ang1 (/(cadar segLst)2))
		     (polar plStart1 (+ pi ang1)(/(cadar segLst)2))
		     (polar(caadr segLst)(+ pi ang2)(/(nth 2(car segLst))2))
		     (polar(caadr segLst)ang2(/(nth 2(car segLst))2))
		     ); end list
	          ); end mapcar
		); end setq
       ); end if
 ); end if
     (setq plStart1(trans plStart1 0 1)
      plEnd(trans plEnd 0 1)
  ); end setq
   	(if plStart2
     		(setq plStart2(trans plStart1 0 1))
     	); end if
      (if
 (and
   (< 2(length segLst))
  (or
      (not(equal ang1 ang2 0.000001))
      (/=(cadar segLst)(nth 2(car segLst)))
    ); end or
   ); end and
      (progn
       	(setvar "PLINEWID" 0.0)
       	(command "_.pline")
	(mapcar 'command ptLst)(command "_c")
       	(setvar "PLINEWID" dpipepWd)
); end progn
 ); end if
   (if
     (and
       (not(equal ang1 ang2 0.000001))
       (< 2(length segLst))
     ); end and
     (progn
      	(setq lPln
      (vlax-ename->vla-object(entlast))
      tAng(- ang2 ang1)
     ); end setq
       (if(minusp tAng)(setq tAng(- tAng)))
        (if
	  (and
	   (< 0 tAng)
	   (>= pi tAng)
	   ); end and
	 (progn
       		(vla-SetBulge lPln 1 (/(- ang2 ang1)4))
       		(vla-SetBulge lPln 3 (/(- ang1 ang2)4))
         ); end progn
	 (progn
	   (if(< ang1 ang2)
	     (setq ang1(+ ang1 pi)
		   ang2(- ang2 pi)); end setq
	     (setq ang1(- ang1 pi)
		   ang2(+ ang2 pi)); end setq
	     ); end if
	   	(vla-SetBulge lPln 1 (/(- ang2 ang1)4))
       		(vla-SetBulge lPln 3 (/(- ang1 ang2)4))
	   ); end progn
	 ); end if
      ); end progn
 ); end if
 (if
   (=(cadar segLst)(nth 2(car segLst)))
   	 (command "_.mline" "_st" "DUCT_PIPE"
	"_S" (cadar segLst) "_J" "_Z"
	plStart1 plEnd "")
   ); end if
   
   (setq segLst(cdr segLst)); end setq
   ); end while
 (command "_.erase" lEnt "")
 (asmi-LayersStateRestore stLst)
 ); end progn
   ); end if
   ); end of Body Function

   (defun *error*(msg)
   (BodyFunction)
   (if oldVars
     (mapcar 'setvar
     '("FILLMODE" "PLINEWID" "CMDECHO" "OSMODE")
     oldVars); end mapcar
    ); end if
    (if actDoc
     (vla-EndUndoMark actDoc)
     ); end if
   (princ)
   ); end of *error*

 (PipeMLineStyle)
 
 (if(not dpipepWd)(setq dpipepWd 1.0))
 (setq oldWd dpipepWd
oldVars(mapcar 'getvar '("FILLMODE" "PLINEWID" "CMDECHO" "OSMODE"))
       ); end setq
 (if(entlast)(setq lObj(entlast)))
 (vla-StartUndoMark
  (setq actDoc
   (vla-get-ActiveDocument
     (vlax-get-acad-object))))
 (initget 128)
 (while(not cFlg)
  (setq fPt
 (getpoint
   (strcat
     "\nSpecify start point or width <"
     (rtos dpipepWd) ">: " ))); end setq
   (cond
     ((= 'LIST(type fPt))
      (setq cFlg T)
      ); end condition #1
     ((= 'REAL(type(distof fPt)))
      (setq dpipepWd(distof fPt)); end setq
      ); end condition #2
     (T
      (princ "\nInvalid option keyword! ")
      ); end condition #3
     ); end cond
   ); end while
   (mapcar 'setvar
 '("FILLMODE" "PLINEWID" "CMDECHO")
 (list 0 dpipepWd 0)); end mapcar
 (command "_.pline" fPt)
 (setvar "CMDECHO" 1)
 (while(= 1(getvar "CMDACTIVE"))
   (command pause)
   ); end while
 (BodyFunction)
 (vla-EndUndoMark actDoc)
(mapcar 'setvar
     '("FILLMODE" "PLINEWID" "CMDECHO" "OSMODE")
     oldVars); end apply
 (princ)
 ); end of c:dpipe

Link to comment
Share on other sites

Now in occasion of superfluous options.

 

Unfortunately here there are restrictions.

I can represent on the screen a dynamic double line in three ways. 1) a standard wide polyline (that that is realized in the program) 2) the multiline 3) function GRREAD.

 

But all has the lacks:

1) I cannot to hide messages of this command as if it is necessary to change width, you will not see any message. Also I cannot add the own options in a standard command.

2)Cannot change width and add own options.

3)All options possible, but large additional code and snaps do not work.

 

There are two ways by means of which it is possible to make any options.

 

1) To refuse a double dynamic line.

2) To use DynDraw200X.arx (free). The special file written by fine ObjectArx programmer Alexander Rivilis. It works as function GRREAD, but with snaps and transparent commands, such as change of snaps, swich on/off Orto, etc. In this case it is possible to clean not the necessary options and to add necessary. For example change Justification during of a command, the round caps (if it drop or sprig), change of width with automatic drawing of reducer etc.

 

But I am not assured yet, whether it is necessary to me to begin this code as it absolutely new code and there anything from that that will not be already written. Also I can tell that it large code, I think more than 1000 lines. :?:

Link to comment
Share on other sites

ASMI, it is no problem if you can't remove the extra options. I didn't know they were part of the dynamic double line. I thought that they were options you added specifically.

 

So it's fine if you leave the arc and halfwidth options in there, I just won't be using them, but don't put any more time into fixing them if you don't want to.

 

The only option that I would want changed is having to put "start width" in there, it isn't needed. But if it is hard to change then don't worry about it. You have done so much already!

 

And Justification is not needed very much either, so I don't want you to work on it more then is reasonable.

 

Thanks again.

Link to comment
Share on other sites

>Vigilante

 

It is good, while we shall leave all as is. Do yo like last code with 'Specify start point or width :' query? Now you do not need to specify wide every time, you can specify wide or pick start point.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...