Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flex Lisp Routine

24 REPLIES 24
Reply
Message 1 of 25
Anonymous
6322 Views, 24 Replies

Flex Lisp Routine

I'm looking to get my hands on a lisp routine that will draw a uniform "zig zag" patter along a pline. Can anyone point me in the right direction, or pass along their own lisp? Thank you in advance for any help.

 

Jarrad

24 REPLIES 24
Message 2 of 25
Patchy
in reply to: Anonymous

Why not changing the polyline to zigzag line in properties?

Message 3 of 25
Anonymous
in reply to: Patchy

Patchy,

 

Thank you for the quick turnaround. We do not have a zig zag linetype.

 

Jarrad

Message 4 of 25
Patchy
in reply to: Anonymous

Have you loaded that line type? most autocad version has it.

 

Looks like this

 

*ZIGZAG,Zig zag /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
A,.0001,-.2,[ZIG,ltypeshp.shx,x=-.2,s=.2],-.4,[ZIG,ltypeshp.shx,r=180,x=.2,s=.2],-.2

 

(still needs ltypeshp.shx to run)

 

 

Message 5 of 25
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

I'm looking to get my hands on a lisp routine that will draw a uniform "zig zag" patter along a pline. ....



Since you use the word "Flex" in your Subject, and since flexible ductwork is often represented with zig-zag lines, I assume that's what you're talking about.  I don't think AutoCAD's ZIGZAG linetype looks very good for that [too loose with its 90-degree bends], so I made my own.  This goes in the .lin file:

 

*FLEXDUCT,Tight zig-zag /\/\/\/\/\/\/\/\/\
A,.0001,-.25,[FLEXDUCT,YourShapeFile.shx,x=-.25,s=.25],-.5,[FLEXDUCT,YourShapeFile.shx,r=180,x=.25,s=.25],-.25

 

and this [change the 141 if you need to] goes in the YourShapeFile.shp/.shx file:

 

*141,7,FLEXDUCT
8,(1,8),8,(1,-8),0
 

It looks like the attached image.  Use a linetype scale of the width [diameter] you want divided by the real-world-to-drawing ratio [usually in the DIMSCALE System Variable] -- e.g. for 6" diameter flex duct in a drawing at 1/4"=1'-0" scale, give things drawn with this a linetype scale of 6 divided by 48 = 0.125.

Kent Cooper, AIA
Message 6 of 25
stevesfr
in reply to: Kent1Cooper

Kent, getting error when trying to load the FLEXDUCT linetype. error is

Bad definition of FLEXDUCT at line 128 (128 may or may not be important) of file ..... acad.lin

you mention possibly the 141?? may need to be changed or revised... to what?

I fixed/added ltypeshp.shx to the definition... thats ok.

attached is what I patched into acad.lin

*FLEXDUCT,Tight zig-zag /\/\/\/\/\/\/\/\/\
A,.0001,-.25,[FLEXDUCT,ltypeshp.shx,x=-.25,s=.25],-.5,[FLEXDUCT,ltypeshp.shx,r=180,x=.25,s=.25],-.25

 

however acad didn't like it...

thx in advance for look-see

Steve

Message 7 of 25
Anonymous
in reply to: Anonymous

See post.  I thought the Flex2point.lsp on the last post was good.

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Flexible-Duct/td-p/1962520/page/2

Message 8 of 25
Anonymous
in reply to: stevesfr

DId you add the shape definition text to your shape file and compile it?  This may be the problem.

Message 9 of 25
Kent1Cooper
in reply to: stevesfr


@stevesfr wrote:

.... error is

Bad definition of FLEXDUCT at line 128 (128 may or may not be important) of file ..... acad.lin

you mention possibly the 141?? may need to be changed or revised... to what?

....


 

The 141 just needs to be different from the number in the same position for other shape definitions, which it may not be if you have a lot of added ones beyond those that come in AutoCAD's ltypeshp.shp file.

 

If it's the last shape definition in the file, I think you need to finish the last line with an Enter, so the ctrl-End location in the file is an empty line at the end, not the end of a line with content.

Kent Cooper, AIA
Message 10 of 25
stevesfr
in reply to: Anonymous

Good suggestion, but that is not the problem. Acad sez its in this line,

 

A,.0001,-.25,[FLEXDUCT,ltypeshp.shx,x=-.25,s=.25],-.5,[FLEXDUCT,ltypeshp.shx,r=180,x=.25,s=.25],-.25

 

anyone else get this to work besides Kent?

 

Message 11 of 25
Anonymous
in reply to: stevesfr

Steve, it worked for me but I pasted Kent's data into my own shape file for my custom linetypes and not into the AutoCAD standard.  I adjusted the number (141)  to the next number of my last shape definition and compiled the file.  I then pasted the data into my lin file and it worked.  You may need to post both your lin and shp files to see where the problem is.

Message 12 of 25
stevesfr
in reply to: Anonymous

OK here are my acad.lin and my ltypeshp.shp files.  You may have to rename them because of frowned upon file types here. (yawn)  rename acad.txt to acad.lin and rename ltypeshp.txt to ltypeshp.shp

TIA

Steve

Message 13 of 25
Anonymous
in reply to: stevesfr

Go to the end of line of Kent's data (.25) and hit the return key and save the file.  There needs to be a line between Kent's data and the ;; HTH.

Message 14 of 25
Kent1Cooper
in reply to: stevesfr


@stevesfr wrote:

.... Acad sez its in this line,

 

A,.0001,-.25,[FLEXDUCT,ltypeshp.shx,x=-.25,s=.25],-.5,[FLEXDUCT,ltypeshp.shx,r=180,x=.25,s=.25],-.25


When I copy and paste that line into Notepad, there's an unknown-character rectangle between the comma after the first right bracket and the -.5 [between the two bold red characters as quoted above].  It's not there when I copy and paste from the source line in my first post, nor of course in my .lin file.  Check that something hasn't crept in there in the process of your copying/pasting/editing.

 

[EDIT -- to further muddy the waters, I get the extra character when I copy/paste from your message that this one is in reply to, but not when I do it from this reply.]

Kent Cooper, AIA
Message 15 of 25
Anonymous
in reply to: Kent1Cooper

I did a cut/paste into Notepad and I do not get that extra character you state.  Hmmmmmm!!!!

 

Something to watch out for in the future.

 

By the way thanks for sharing your info.

Message 16 of 25
stevesfr
in reply to: Anonymous

I hoping to learn something tonight, but I guess we'll hope for tomorrow.

would someone care to share their acad.lin, maybe I'll see the forrest instead of the trees, and put the two side by side.

Steve

Message 17 of 25
Anonymous
in reply to: stevesfr

Your portion of your file

;*FLOW,---->---->---->---->
;A,.5,-.5,["g",WINGDINGS,S=.5,R=0.0,X=-0.4,Y=-0.25],-.25
*FLEXDUCT,Tight zig-zag /\/\/\/\/\/\/\/\/\
A,.0001,-.25,[FLEXDUCT,ltypeshp.shx,x=-.25,s=.25],-.5,[FLEXDUCT,ltypeshp.shx,r=180,x=.25,s=.25],-.25
;;  Add any linetypes that you define to this section of [Here is where your problem is, no line separation]
;;  the file to ensure that they migrate properly when
;;  upgrading to a future AutoCAD version.  If duplicate

 

This is where the fix needs to be.

;*FLOW,---->---->---->---->
;A,.5,-.5,["g",WINGDINGS,S=.5,R=0.0,X=-0.4,Y=-0.25],-.25
*FLEXDUCT,Tight zig-zag /\/\/\/\/\/\/\/\/\
A,.0001,-.25,[FLEXDUCT,ltypeshp.shx,x=-.25,s=.25],-.5,[FLEXDUCT,ltypeshp.shx,r=180,x=.25,s=.25],-.25

[Need a line separation here, see the rest of your file, see the difference between the AutoCAD, ISO's and Complex]

;;
;;  Add any linetypes that you define to this section of
;;  the file to ensure that they migrate properly when
;;  upgrading to a future AutoCAD version.  If duplicate

 

Corrected file attached

Message 18 of 25
stevesfr
in reply to: Anonymous

That did not help. I must have something else royally screwed up.

Steve

Message 19 of 25
Anonymous
in reply to: stevesfr

Cheer up, No big deal........

 

Try these.  Just rename by removing the txt and insert a period in front of lin, shp and shx.  Which you could have figured out on your own,  Hope this fixes things.  Later.

Message 20 of 25
Kent1Cooper
in reply to: stevesfr


@stevesfr wrote:

That did not help. I must have something else royally screwed up.


Just to confirm -- the .shp file needs to be Compiled into a .shx file before the .lin file can use what's in it.  You would certainly have a problem without that, and it's not quite clear to me in earlier messages whether that's been done.

 

[I'd also be interested in whether thread-originator jarrad27 has tried it and gotten it to work, just as a comparison test, or perhaps went for the Flex2point routine from the link azrdgldr posted.]

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost