• このフォーラムは、www.cad3d.it/forum1 - イタリアのデザインコミュニティの機械翻訳です。いくつかの用語は正しく翻訳されていません。

変数 ilogic ルールを追加

  • Thread starter Thread starter silvia_cherry
  • Start date Start date

silvia_cherry

Guest
ciao a tutti!

ho questa regola ilogic che mi esporta il dxf delle varie lamiere all'interno di un assieme in inventor

'define the active document as an assembly file
dim oasmdoc as assemblydocument

oasmdoc = thisapplication.activedocument

oasmname = left(oasmdoc.displayname, len(oasmdoc.displayname) -4)



'check that the active document is an assembly file
if thisapplication.activedocument.documenttype <> kassemblydocumentobject then

messagebox.show("please run this rule from the assembly file.", "ilogic")

exit sub

end if

'get user input
rusure = messagebox.show ( _
"this will create a dxf file for all of the asembly components that are sheet metal." _
& vblf & "this rule expects that the part file is saved." _
& vblf & " " _
& vblf & "are you sure you want to create dxf for all of the assembly components?" _
& vblf & "this could take a while.", "ilogic - batch output dxfs ",messageboxbuttons.yesno)

if rusure = vbno then

return

else

end if

opath = thisdoc.path

odatamedium = thisapplication.transientobjects.createdatamedium

ocontext = thisapplication.transientobjects.createtranslationcontext

ocontext.type = iomechanismenum.kfilebrowseiomechanism

ooptions = thisapplication.transientobjects.createnamevaluemap

'get dxf target folder path
ofolder = opath & "\" & oasmname & " dxf files"

'check for the dxf folder and create it if it does not exist
if not system.io.directory.exists(ofolder) then

system.io.directory.createdirectory(ofolder)

end if
'- - - - - - - - - - - - -

'- - - - - - - - - - - - -component - - - - - - - - - - - -
'look at the files referenced by the assembly

dim orefdocs as documentsenumerator

orefdocs = oasmdoc.allreferenceddocuments

dim orefdoc as document


'work the the drawing files for the referenced models
'this expects that the model has been saved

for each orefdoc in orefdocs

iptpathname = left(orefdoc.fulldocumentname, len(orefdoc.fulldocumentname) - 3) & "ipt"

'check that model is saved
if(system.io.file.exists(iptpathname)) then

dim odrawdoc as partdocument

odrawdoc = thisapplication.documents.open(iptpathname, true)

ofilename = left(orefdoc.displayname, len(orefdoc.displayname))

try

'set the dxf target file name
odatamedium.filename = ofolder & "\" & ofilename & ".dxf"

dim ocompdef as sheetmetalcomponentdefinition

ocompdef = odrawdoc.componentdefinition

if ocompdef.hasflatpattern = false then

ocompdef.unfold

else

ocompdef.flatpattern.edit

end if

dim sout as string

sout = "flat pattern dxf?acadversion=2004" _
+
"&outerprofilelayer=iv_outer_profile" _
+
"&interioprofileslayer=iv_interior_profiles" _
+
"&invisiblelayers=iv_tangent;iv_bend;iv_bend_down;iv_bend_up;iv_arc_centers;iv_tool_center;iv_tool_center_down;iv_feature_profiles;iv_feature_profiles_down;iv_altrep_front;iv_altrep_back;iv_unconsumed_sketches;iv_roll_tangent;iv_roll"

ocompdef.dataio.writedatatofile( sout, odatamedium.filename)

'just for check its works coretcly
'i=messagebox.show(odatamedium.filename, "title",messageboxbuttons.okcancel)


'messagebox.show(i,"title",messageboxbuttons.ok)

'if i=2 then

'exit sub

'end if

ocompdef.flatpattern.exitedit

catch

end try

odrawdoc.close

else

end if

next


la regola funziona benissimo, mi esporta tutte le lamiere però io non vorrei che me le esportasse tutte (alcune di queste il cliente le ha già a magazzino quindi non deve ordinarle che è il motivo per cui faccio i dxf che verranno poi inviati al fornitore) per distinguere le lamiere da ordinare da quelle no abbiamo inserito la proprietà 'pannello' nel campo 'fornitore' nel menù iproperties. ho visto che si richiama in questo modo

param=iproperties.value("project", "vendor")

la cosa che non riesco a fare è aggiungere alla regola il fatto che se il campo fornitore è vuoto non mi crei il dxf, se presenta la scritta 'pannello' crei il dxf.

grazie mille
 
hi は、ilogic ショートカットに注意してください。たとえば、表示テンプレートファイルのプロパティへのアクセスが必要な場合は、別のアクセス方法を実行する必要があります。
不動産「ベンダー」はどこにありますか? シートに表示パターンファイルはありますか?
 
un metodo più sicuro per accedere alle proprietà dei documenti è quello che ti mostro di seguito.
devi 具体的には cui si trova la proprietà di cui hai bisogno の il docomo です。 penso che dovresti Presentare questo approccio nella tua regola.

odoc をドキュメント = thisdoc.document
文字列 = odoc.propertysets.item("デザイントラッキングプロパティ").item("vendor") として dim のオーブンダー。 バリュー

オラ, per adattare la tua regola, penso che dovresti trovare qualcosa di simile al seguente

'アセンブリファイルとしてアクティブなドキュメントを定義する
dim oasmdoc として アセンブリドキュメント

oasmdoc = このアプリケーション.activedocument

oasmname = left(oasmdoc.displayname, len(oasmdoc.displayname) -4)

'アクティブなドキュメントがアセンブリファイルであることを確認してください
このapplication.activedocument.documenttype <> kassemblydocumentobject の場合、
messagebox.show("アセンブリファイルからこのルールを実行してください。", "ilogic")
出口のサブ
端 もし

'get user 入力
rusure = メッセージボックス.show ( _)
"これは、シートメタルであるすべてのアセンブリコンポーネントのdxfファイルを作成します。" ツイート
& vblf & "このルールは、部分ファイルが保存されていることを期待しています。" ツイート
と vblf と " _
& vblf & "すべてのアセンブリコンポーネントのdxfを作成したいですか? ツイート
& vblf & "これはしばらくかかることができます。", "ilogic - バッチ出力dxfs ",messageboxbuttons.yesno"

rusure = vbno なら、

フィードバック

その他

端 もし

opath = このドキュメント.path

odatamedium = このアプリケーション。transientobjects.createdatamedium

ocontext = thisapplication.transientobjects.createtranslationcontext

ocontext.type = iomechanismenum.kfilebrowseiomechanism

ooptions = thisapplication.transientobjects.createnamevaluemap

'get dxf ターゲットフォルダーパス
ofolder = opath と "\" と oasmname と "dxf ファイル"

'dxf フォルダーをチェックし、存在しない場合に作成します。
system.io.directory.exists(ofolder)でなければ、

system.io.directory.createdirectory(フォルダ)

端 もし
- - - - - - - - - - - -
ひもとしてオーブンを薄暗くして下さい
'参照されたモデルの描画ファイルを扱う
'これはモデルが保存されていることを期待しています
oasmdoc.allreferenceddocuments のドキュメントとして各 Orefdoc に対して
topdor = orefdoc.propertysets.item("デザイントラッキングプロパティ).item("ベンダー)。 バリュー "pannello" と "pannello"iptpathname = left(orefdoc.fulldocumentname, len(orefdoc.fulldocumentname) - 3) & "ipt"

'モデルが保存されているチェック
if(system.io.file.exists(iptpathname) 以降

dim odrawdoc として partdocument

odrawdoc = thisapplication.documents.open(iptpathname, true) ディレクティブ

ofilename = left(orefdoc.displayname, len(orefdoc.displayname)))

お問い合わせ
'dxf ターゲットファイル名を設定する
odatamedium.filename = ofolder & "\" & ".dxf"

dim ocompdef シートメタルコンポンデント定義

ocompdef = odrawdoc.componentdefinition

ocompdef.hasflatpattern = false の場合、
ocompdef.unfoldの
その他
ocompdef.flatpattern.edit は、
端 もし

dim sout を文字列として

sout = "フラットパターンdxf?acadversion=2004" _

"&outerprofilelayer=iv_outer_profile" は、

"&interioprofileslayer=iv_interior_profiles" は、

"&invisiblelayers=iv_tangent;iv_bend;iv_bend_down;iv_bend_up;iv_arc_center;iv_tool_center;iv_tool_center_down;iv_feature_profiles_down;iv_feature_profiles_down;iv_altrep_front;iv_altrep_back;iv_unconsumed_sketches;iv_roll_tangent;iv_feature_profiles_down

ocompdef.dataio.writedatatofile( sout, odatamedium.filename) のファイル

'ちょうどその作品をチェックする
'i=messagebox.show(odatamedium.filename、"title"、messageboxbuttons.okcancel)

'messagebox.show(i,"title",messageboxbuttons.ok)

i=2 の場合

'exit サブ

もしも

ocompdef.flatpattern.exitedit がリリースされました。

キャッチ

エンドトライ

odrawdoc. クローズ
端 もし 端 もし次へ

赤で追加された線を強調しました。
この方法では、各ファイルの "supplier" プロパティの値と、このプロパティが "panel" と等しい場合は、必要なときに dxf に変換されます。 (逆に「差分」を作成するために署名<>で=を取り替える必要がある場合)
また、「tab」ボタンで再編を実施し、コードをもっと読みやすく、初めて理解しやすいようにしました。 再編成されていない場合、特定の指示を開始し、終了する最初の視力では知られていません。
コードの貢献をクリアしてほしい。 プロパティへのアクセスの詳細については、この情報を参照することができます。 vba 言語ですが、簡単にilogicalに適応することができます。
https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html お問い合わせ
グッドビー
 
私はフォーラムで新しくて、タブキーで修正を行うことができないことを確認できたので、スペースを入れると削除されます。 ご挨拶
 
お問い合わせ 明日を知らせていきましょう。 ありがとうございました!
 

Forum statistics

Threads
46,674
Messages
380,976
Members
2
Latest member
loop80
このフォーラムは、www.cad3d.it/forum1 - イタリアのデザインコミュニティの機械翻訳です。いくつかの用語は正しく翻訳されていません。

Members online

No members online now.
Back
Top