Mark feature

Mark feature

vishnuteja_srikanti
Participant Participant
576 Views
5 Replies
Message 1 of 6

Mark feature

vishnuteja_srikanti
Participant
Participant

I want to create mark feature using vb.net code 

I am able to create mark feature definition but mark feature is not adding below is the code I am using can anyone help me where am i going wrong

 

 

Dim pXtrudFtr_1 As MarkDefinition = Nothing
Dim pmarkstyl As MarkStyle = pPlatePart_Ref_Doc.MarkStyles.Item(1)
Dim pname As String = pmarkstyl.Name
Dim PMARKFETR As MarkFeatures = pPlatePart_Ref_Doc.ComponentDefinition.Features.MarkFeatures

 

If pEnti Is Nothing OrElse pEnti.Count = 0 Then
MsgBox("No sketch entities found.")
Exit Sub
End If

If pmarkstyl Is Nothing Then
MsgBox("MarkStyle is not valid.")
Exit Sub
End If

If pXtrudFtr_1 Is Nothing Then

End If

Try
pXtrudFtr_1 = pPlatePart_Ref_Doc.ComponentDefinition.Features.MarkFeatures.CreateMarkDefinition(pEnti, pmarkstyl)
If pXtrudFtr_1 Is Nothing Then
MsgBox("not created")
End If
Dim omarkfetr As MarkFeature
omarkfetr = PMARKFETR.Add(pXtrudFtr_1)


Catch ex As Exception

End Try

0 Likes
577 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Dropping a link in here to my reply to your similar question in another forum discussion a few minutes ago.

https://forums.autodesk.com/t5/inventor-programming-ilogic/adding-new-mark-feature-to-flat-pattern-w... 

I attached a text file to that reply with an iLogic rule code example in it for creating a MarkFeature in the FlatPattern for the FileName.  That should give you some clues.  The most common misunderstanding is that the FlatPattern object is another, separate ComponentDefinition, with its own separate set of Parameters, features, and such.  You must access that special, lower level definition before accessing the sketches & features that you will be using or creating within it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

vishnuteja_srikanti
Participant
Participant

thanks @WCrihfield i have got achieved the mark feature in folded part

 

now i have one more issue which i am not understanding here please help me in understanding if there is any reason behind it.

 

case-1 :

i have an assembly say assy1.iam   with 10 components as subassemblies and 2 parts components say one is base component and other part1.ipt component. In each sub-assemblies I have a sketch which I am projecting on base component which is also included in same assembly assy1.iam 

I am able to create mark feature for all these sketches projected on to base component this works good till here now the left over part1 component which is also a circular pattern in assy1.iam i am projecting sketch which is available in part1 component on to base component in same process as i did with sub assembly sketch projections but here i am unable to create mark feature for sketch projected by part1.ipt component.

 

case:2 

i have deleted all subassemblies in assy1.iam and kept only part1.ipt which is a circular pattern and a base component now using same code i have projected the sketch availble in part1.ipt component on to base component and performed mark feature operation it works fine without error 

 

i am using same code for both cases but i am confused how it is not performing in case 1

 

not only i tried with code but i tried manually also it shows error while creation markfeature says "

 

this is case 1- assy1 pics where i error at last occurance of part which i have rounded in pic -2 only sketch is projecting 

 

vishnuteja_srikanti_0-1749627146141.pngvishnuteja_srikanti_1-1749627259200.png

vishnuteja_srikanti_2-1749627360551.png

 

let me know if there anything i am missing 

 

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

Hi @vishnuteja_srikanti.  That is a complicated sounding scenario, so difficult to fully understand.

The error message shown is relatively common in certain situations.

It could mean:

  • The direction being specified for the feature may be pointing the wrong way, meaning it will not have any effect on the model.
  • The location &/or overall size of the feature may not be entirely on the model, meaning either some, or all of the feature will not be effecting the model.
    • For example:  If attempting to 'Mark' text or geometry on a flat face of a part, and any portion of that text or geometry not within the bounds of that face, or any portion of it is over a 'hole' or cutout through that face/part, you will likely get an error like this, because it is expecting the entirety of that geometry to get translated to the model.
    • Because of this, the location of the Mark feature can be critical, and also the specific area that the text or geometry included in the Mark feature will cover on the model must be 'clear' of any cutouts.
    • Those details can be difficult to predict when lots of changes may be going on.
  • If the sketch that is being used to define a feature within a part is 'Adaptive' (gets the two red & blue circular arrows icon), which usually means it is Linked to something projected from an assembly that the part is a component within, then something happens to that source geometry in the assembly, that can cause problems within the part, because it is dependent on that source geometry.  Something like that may cause an error like this.

I can't be sure if one of those things mentioned above is the cause of this, or maybe something else that I haven't thought of.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

vishnuteja_srikanti
Participant
Participant

hello,

i have a question regarding mark feature 

steps i am following to create a mark feature on sheet metal is 

1. i preparing a sketch manually on surface of the sheet 

2. i  goto mark feature tab and select the sketch geometries then complete the mark feature 

now my question is this procedure correct to ? 

later i am preparing a .idw with the view of sheet flat pattern and then saving it as copy as dxf which i am opening in autocad will this be enough for laser cutting programmers to get the data of mark features 

0 Likes
Message 6 of 6

WCrihfield
Mentor
Mentor

Although I do design a lot of sheet metal parts on a regular basis in Inventor, I rarely need to create flat patterns for them for CNC purposes, because we usually have other companies fabricate them for us.  I do not actually use MarkFeatures that much myself either, but understand them pretty well.  If you have not already done so, you should probably look into the MarkStyle objects used when creating MarkFeatures.  They seem to contain a lot of useful sounding properties and methods which you could probably make good use of, and may even want to create some custom MarkStyles with those settings the way you want them.  One of the most important properties of a MarkStyle is its MarkStyle.MarkDepthType property, which is Read/Write and has a MarkTypeEnum type value.  That is what determines if the mark just marks the first surface it comes to, or if it goes all the way through the part.  And since it is possible for a mark feature to only effect one side of the material, or effect both sides, there are lots of settings for the 'layer' being used for that geometry on one side, independently of the other side, with their own line type, line weight, line color, and so on.  I'm not sure how well that model data carries over into a view of the flat pattern within a drawing document though.  Since drawing documents do use layers, where model documents generally do not, plus we can include annotations, such as bend lines/notes, it would seem like exporting the flat pattern from the drawing, instead of directly from the model, might have more options for customizing the layers though.

When exporting a sheet metal flat pattern directly from the model, about the best way to do so is like the following:

While in the flat pattern editing mode, right-click on the main flat pattern node in the model browser tree, then choose 'Save Copy As...'.  That shows a file dialog for you to specify the file name and location, but the 'Options' button is greyed out.  However, once you specify the name and location, then click the OK button on that dialog, a second dialog shows, labeled 'Flat Pattern DXF Export Options', which is very intuitive, and has lots of settings & options spread out across 3 different tabs.  One of those tabs is for customizing the Layers.  And when your flat pattern includes mark feature geometry, there are usually at least two additional layers listed in there.  One named "IV_MARK_SURFACE" (Front), and one named "IV_MARK_SURFACE_BACK" (Back).  We can also save those export settings configuration out to an 'INI' file, so that we can use it again later.  When exporting from a drawing, instead of directly from the model, I'm not sure if we can use the same INI file that we created on the model side, but specifying an INI file is the only option we have when going through the TranslatorAddIn.SaveCopyAs method.  If attempting to export directly from the model by code, I think our only option is to use the FlatPattern.DataIO.WriteDataToFile method, which forces us to use a single String type value.  That one String must contain all those specifications, which can make it potentially super long, really complexly formatted.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes