Plik XYZ i problem


Autor tematu
tomasek77
Czytelnik forum poziom 1 (min. 10)
Czytelnik forum poziom 1 (min. 10)
Posty w temacie: 1
Posty: 14
Rejestracja: 13 maja 2008, 12:55
Lokalizacja: internet

Plik XYZ i problem

#1

Post napisał: tomasek77 » 23 lut 2010, 20:31

Koledzy pomożcie mam plik *.xyz otworzylem go w VRMESh chce eksportowac to do programu CATIA lub SOLIDWORKS zeby pozniej stworzyc powierzchnie i caly model.Eksportowalem do dxf ale catia sie wysypuje i nie otwiera tego.

[ Dodano: 2010-02-23, 21:00 ]
ok narazie poradzilem sobie tak ze wyeksportowalem do pliku txt tyle ze jest tego ponad 2 mln :) da sie to teraz jakos wczytac do Cati lub Solida zeby nie wpisywac tych punktów??

[ Dodano: 2010-02-23, 22:08 ]
poszukalem znalazlem macro do cati ale niestety wywal mi blad czy ktos mi moze pomoc.
A poważnie:
1. Tools\Macro\Macros
2. W oknie Macros:
a/ W polu Current macro library or document ustalasz czy chcesz, aby makro było zapisane z modelem czy we wskazanym folderze na dysku
b/ wybierz Create
3. W oknie Create a new macro:
a/ zmień Macro language z MS VBScript na CATScript
b/ zmień nazwę z Macro1 na COKOLWIEK
c/ OK
4. W oknie Macros wybierz Edit
5. W oknie Macros Editor wklej skopiowany kod makra

Kod makra1 (czyta punkty z pliku TXT):
--------------------------------------------------------------------------------
Language="VBSCRIPT"

Sub CATMain()

Dim oPart As Part
set oPart=CATIA.ActiveDocument.Part
Dim hsf As Factory
set hsf = oPart.HybridShapeFactory
Dim hyb As HybridBodies
set hyb = oPart.HybridBodies
Dim NewSet As HybridBody
set NewSet=hyb.Add()
NewSet.Name="ImportedFromFile"

Dim point1 As HybridShapePointCoord
Dim point2 As HybridShapePointCoord
Dim NewSpline As HybridShapeSpline
Dim ref1 As Reference
Dim ref2 As Reference

Dim oFileSys as FileSystem
Set oFileSys = CATIA.FileSystem
Dim oFileIn As File
Set oFileIn = oFileSys.GetFile("C:\Temp\Import points from TXT\Points.txt") 'Change your path here
Dim oStream As TextStream
Set oStream = oFileIn.OpenAsTextStream("ForReading")
sLine = oStream.ReadLine
NumberOfPoints = 0

While (sLine <> "")
pointCoords = Split(sLine, " ") ' Specify your delimiter here
NumberOfPoints = NumberOfPoints +1
set point1=hsf.AddNewPointCoord (pointCoords(0),pointCoords(1),pointCoords(2))
NewSet.AppendHybridShape point1
oPart.Update
sLine = oStream.ReadLine
Wend

oStream.Close
oPart.Update
End Sub
--------------------------------------------------------------------------------

Kod makra2 (czyta punkty z pliku TXT i rozpina spline na tych punktach)
--------------------------------------------------------------------------------
Language="VBSCRIPT"

Sub CATMain()

Dim oPart As Part
set oPart=CATIA.ActiveDocument.Part
Dim hsf As Factory
set hsf = oPart.HybridShapeFactory
Dim hyb As HybridBodies
set hyb = oPart.HybridBodies
Dim NewSet As HybridBody
set NewSet=hyb.Add()
NewSet.Name="ImportedFromTXTFile"

Dim point1 As HybridShapePointCoord
Dim NewSpline As HybridShapeSpline
Set NewSpline = hsf.AddNewSpline()
Dim ref1 As Reference
Dim ref2 As Reference

'Change Max number of spline points here
Dim TabPt(100)
PointNumber = 0

Dim oFileSys as FileSystem
Set oFileSys = CATIA.FileSystem
Dim oFileIn As File
Set oFileIn = oFileSys.GetFile("C:\Temp\Import points from TXT\Points.txt") 'Change your path here
Dim oStream As TextStream
Set oStream = oFileIn.OpenAsTextStream("ForReading")
sLine = oStream.ReadLine

While (sLine <> "")
pointCoords = Split(sLine, " ") ' Specify your delimiter here
PointNumber = PointNumber +1
set TabPt(PointNumber) =hsf.AddNewPointCoord (pointCoords(0),pointCoords(1),pointCoords(2))
NewName ="Punkt" & "." & PointNumber
Set ref1 = oPart.CreateReferenceFromObject(TabPt(PointNumber))
hsf.ChangeFeatureName ref1 ,NewName
NewSet.AppendHybridShape TabPt(PointNumber )
oPart.Update
sLine = oStream.ReadLine
Wend
oStream.Close
For I=2 to PointNumber
Select Case I
Case 2
Set ref1 = oPart.CreateReferenceFromObject(TabPt(1))
NewSpline.AddPointWithConstraintExplicit ref1, Nothing, -1.000000, 1, Nothing, 0.000000
Set ref2 = oPart.CreateReferenceFromObject(TabPt(2))
NewSpline.AddPointWithConstraintExplicit ref2, Nothing, -1.000000, 1, Nothing, 0.000000
Case Else
Set ref2 = oPart.CreateReferenceFromObject(TabPt(I))
NewSpline.AddPointWithConstraintExplicit ref2, Nothing, -1.000000, 1, Nothing, 0.000000
End Select
Next
NewSet.AppendHybridShape NewSpline
Set ref1 = oPart.CreateReferenceFromObject(NewSpline)
hsf.ChangeFeatureName ref1 ,"GeneratedSpline"
oPart.Update
End Sub



Tagi:

Wróć do „Ogólne dyskusje na temat oprogramowania CAD/CAM”