PDA

View Full Version : how to export a text file to ansys and text file to structur


nsdhakar
03-04-2005, 01:22 PM
i have generated a text file in autocad through VBA programming, now i want
that this file to export in ansys so that it can read that automatically
and read the commands i have wriiten in text file.
i arranged the text file according to the ansys input command file, now
what i need is to export this text file in to ansys.

also one more thing can this is possible that if i put text file which i
generated in autocad according to ansys input command file in autocad again
and it results in a structure from which the text file generated.
if yes than how i can do it.

need it badly. :(

thanks

nsdhakar

Eddie
04-04-2005, 08:15 PM
:?: Are needing the autocad generated text file to be structured so you import it into ansys ??

nsdhakar
04-04-2005, 09:05 PM
i have already structured my text file (file.txt) according to ANSYS command file, now i want that when i put this file again in autocadd than it results in a drawing of the same structure frm which the text file is generated.

i am posting myt text file also...

/title , frame

/PREP7

!Enter the height and width of the frame:

300, 400

! Define Keypoints

K,1,x1, y1 ! keypoint, #, x, y
K,2,x2, y2
K,3,x3, y3
K,4,x4, y4
K,5,x5, y5
K,6,x6, y6

! Define Lines Linking Keypoints

L,1,2 ! L,keypoint1,keypoint2
L,2,3
L,3,4
L,4,1
L,4,6
L,4,5
L,3,5
L,3,6

! element definition

!

ET,1,LINK1 ! element type #1; spring element
R,1,3250 ! real constant #1; Xsect area: 3200 mm^2
MP,EX,1,200e3 ! material property #1; Young's modulus: 200 GPa


LESIZE,ALL, , ,1,1,1 ! specify divisions on unmeshed lines
LMESH,all ! mesh all lines

!
FINISH ! finish pre-processor
!
/SOLU ! enter solution phase
!
! apply some constraints

DK,1,UX,0,,,UY,UZ ! define a DOF constraint at a keypoint
DK,7,UY,0,,,UZ

!
! apply loads
!

FK,1,FY,-280e3 ! define a force load to a keypoint
FK,3,FY,-210e3
FK,5,FY,-280e3
FK,7,FY,-360e3

!
SOLVE ! solve the resulting system of equations

FINISH ! finish solution

/POST1

PRRSOL,F ! List Reaction Forces
PLDISP,2 ! Plot Deformed shape
PLNSOL,U,SUM,0,1 ! Contour Plot of deflection

ETABLE,SAXL,LS, 1 ! Axial Stress
PRETAB,SAXL ! List Element Table
PLETAB,SAXL,NOAV ! Plot Axial Stress


to make more clear, i have generated my text file by using VBA programming in autocad, i know that to get drawing from this text file also need programming in VBA but i am not getting any idea how to do it.

the problem, to export text file to ansys is solved so the problem remains is the above one.

please help me out :(..its really urgent, deadline is very near :(

thanks

nsdhakar

Eddie
05-04-2005, 01:11 AM
8) Ahh....So you want read the text into autocad and have it generate the lines on screen...

nsdhakar
05-04-2005, 01:48 AM
yes, thats what i want :)

please help me

thanks

nsdhakar

nsdhakar
05-04-2005, 01:53 AM
one more thing in text file, the following part...

! Define Keypoints
K,1,x1, y1 ! keypoint, #, x, y
K,2,x2, y2
K,3,x3, y3
K,4,x4, y4
K,5,x5, y5
K,6,x6, y6

is actually like following in text file, means there are values of x1, y1 and so on, assigned to them.


! Define Keypoints
K, 1,4578.2531,7919.0487

K, 2,11346.8678,11826.9102

K, 3,11346.8678,3072.2707

K, 4,4578.2531,3072.2707

K, 5,11346.8678,7919.0487

K, 6,4578.2531,11826.9102

except this everything is correct in text file.

thanks

nsdhakar[/quote]

Eddie
05-04-2005, 03:16 AM
Well if have co-ordinates in the text file then you should be able to do waht you want...

Here is an example from the help files..

Sub Example_AddLine()
' This example adds a line in model space

Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double

' Define the start and end points for the line
startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

' Create the line in model space
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
ZoomAll

End Sub

nsdhakar
05-04-2005, 09:24 AM
but how it will read the co-ordinates from this text file ??

thanks

nsdhakar

hendie
05-04-2005, 10:54 AM
you are talking two entirely different programs here and both programs read and interpret data in different ways.
You have two options open to you. You can either rewrite the data in a format that Autocad can understand, or... You can write a program to import the data and reformat it in a way that Autocad can understand.

Obviously, it will be much easier to manually rewrite the file in a format that Autocad can understand.

nsdhakar
05-04-2005, 01:32 PM
You said that...

"You can write a program to import the data and reformat it in a way that Autocad can understand. "

how i can write the program in vba and how it reformat it??

and in other case what will be the format of the file so that autocad can understand ??

thanks

nsdhakar