help with my piping endcap code please.

#1
in version 10.1 I was able to create a 3d solid of an endcap:
Image
.

However when version 11.0 was released, my lisp stoped working :( This was apparently due to a bug in the code for version 10.1 which was fixed in 11.0.
Since then I have been trying to find a way around the problem. Now on version 11.1

The problem was, I was creating a 2D closed polyline which I was trying to REVOLVE around its centreline. Icad didn't like this. Finally came up with an idea where I create an open polyline, trim back to the ceNtre line and then revolve this. This works, but only some of the time. (see zip file attched below for current code)

Here is a snipet of the code to trim the open polyline

Code: Select all

;--------------------------------------------------------------------
;	-	trim shell to line
	(progn
		(command "_ucs" "w" "")
		(command "_trim" ENTLN1 ENTDH3 "" TP04 "")
		(setq ENTDH3A (entlast))
		(command "_trim" ENTLN1 ENTDH3A "" TP02z1 "")
	)	;end progn		
;-----------end trim shell
This works sometimes and not others, both TP04 & TP02z1 are away from the line to TRIM to.
When this does not work, there appears to be 2 polylines at the same point. But I'm only creating 1.

SteveN

The full code is available in the FREE DWG SECTION.
Attachments
END CAP CODE.zip
(2.64 KiB) Downloaded 226 times

Re: help with my piping endcap code please.

#3
Hi Quan,

I understand what you are saying. Trouble is the randomness of the problem.

Here are a couple of videos of the shape being created & failing.

2D polyline (note: the small line is me proving that the trim selection points are away from the line to trim to):
https://www.dropbox.com/s/omf0zqns964um ... 4.avi?dl=0

And here is the 3D shape being created, including a failure:
https://www.dropbox.com/s/69r94wp4y7evd ... 1.avi?dl=0

The command line lists:
The object should be on one side of the axis.
Unable to revolve 1 selected curve(s)
Why fail? when it's using the same code as previous??

SteveN

Re: help with my piping endcap code please.

#7
Having used the new code for a short while I feel that the 'zoom' in the middle of the component generation will not be suitable on a daily use basis.

So I have decided to try an alternative approach.
In the image below at the bottom is my template for the endcap. with all of the points used to create the shape in white.
I hope to add the 2 new points in red. and use those as the start/finish of the revised shape (top of the image belwo) prior to the 3D revolve. This way I can ommit the need for the TRIM, and also the zoom'.
.
Image
Fortunately I already have the location of ET01, relative to the origin of the shape creation, in the data imported from the dimension file(s)
Sorry for the poor image, but it's the top dim 'E' in the piping dialog on the right.
I also have the location of ET02 as that is ET01 - the wall thickness of the end cap (dim Wall T, 3rd down in the dialog).

Sounds good when I write it down, now to remember how I did it and repeat :)

SteveN

Re: help with my piping endcap code please.

#8
I've run into a problem I don't understand! (code attached.

I've added a few 'princ' comments into the code so I can see how things are progressing

Code: Select all

    (princ (strcat "\nCurrent status for DH:HOD$ is : = " DH:HOD$ " "))

this is before I actually modify anything and is what I expect drwing the profile:
Command:
Goto DH_SSP Set Size Parameters Function
Current status for DH:HOD$ is : = 610
Current status for DH:HTHK$ is: = 46.05
Current status for DH:SFLG$ is: = 129.48
Current status for DH:HDHT$ is: = 305
Current status for HOD$ is : = 610
Current status for HTHK$ T is : = 46.05
Current status for SFLG$ is: = 129.48
Current status for HDHT$ E is : = 305
Goto DH_CDH calculate dished head function
Goto DH_OLL outside arc Point/Bulge list
Goto DH_T_LN DRAW A STRAIGHT PLINE
Goto DH_DDH Draw Dished Head Profile
Command:

However as soon as I remove the ';' from this line

Code: Select all

 ;    (princ (strcat "\nCurrent status for HOD# is : = " HOD# " "))

The code effectively stops??
Goto DH_SSP Set Size Parameters Function
Current status for DH:HOD$ is : = 610
Current status for DH:HTHK$ is: = 46.05
Current status for DH:SFLG$ is: = 129.48
Current status for DH:HDHT$ is: = 305
Current status for HOD$ is : = 610
Current status for HTHK$ T is : = 46.05
Current status for SFLG$ is: = 129.48
Current status for HDHT$ E is : = 305
error: bad argument type

This is where HOD# is defined, note: all 4 '#' have the same result!

Code: Select all

  (setq HOD$  DH:HOD$					;HOD$ is the main OD.
        HTHK$ DH:HTHK$					;HTHK# is the wall thickness.
        SFLG$ DH:SFLG$					;SFLG$ is the flange straight length.
	HDHT$ DH:HDHT$					;HDHT$ is the Cap length 'E'
        HOD#  (distof HOD$  2)				;distof converts string to real value, 2 = decimal
        HTHK# (distof HTHK$ 2)
        HTHT# (distof HTHT$ 2)		
        SFLG# (distof SFLG$ 2)
        HID#  (- HOD# (* HTHK# 2))
        THKL$ DH:THKL$
	);end setq
What am I missing/forgotten?
As later on in the code I want to use this:

Code: Select all

    (setq   ET02A (- HDHT# HTHK#))	;distance from origin to inside End Cap	
But I get the same error: bad argument type
Steve
Attachments
END CAP CODE-F2.zip
(2.95 KiB) Downloaded 203 times
cron