CATIA-CAA二次开发Graphical Properties_第1页
CATIA-CAA二次开发Graphical Properties_第2页
CATIA-CAA二次开发Graphical Properties_第3页
CATIA-CAA二次开发Graphical Properties_第4页
CATIA-CAA二次开发Graphical Properties_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、GraphicalPropertiesHowtouseorimplementtheCATIVisPropertiesInterface3DPLMEnterpriseVisualizationArchitectureAbstractThefirstobjectiveofthisarticleistounderstandwhatarethegraphicalpropertiesThesecondistoexplainhowtheyareintegratedinthevisualizationprocessThreeinterfacesareimportant:CATIVisProperties,C

2、ATIVisuandCATIProperty.Thefirstenablestoassociatewithafeatureasetofgraphicalproperties,thesecondusestheCATIVisPropertiesinterfacetoupdatethegraphicattributesofthegraphicrepresentations,andthelaststoresthedataCATIVisPropertiesisthemaininterfaceofthissystemPrincipeoftheGraphicalPropertiesoTheGraphical

3、PropertiesareGraphicalAttributesoTheTypesofGeometryoTheGraphicalPropertiesbyGeometryTypeoIntegrationoftheGraphicalPropertiesintheVisualizationProcessGeneralitesDefaultbehaviorsoftheSetxxxGraphicAttributemethodsoInshorttheStandardGraphicalPropertiesbyTypeofGeometryoAutomationTheInteractiveCommandsoTh

4、ePropertiesCommandoTheGraphicPropertiesToolbaroTheHide/ShowCommandUsingCATIVisPropertiesImplementingCATIVisPropertiesInShortReferencesPrincipeoftheGraphicalPropertiesBeforetogointoallthedetails,alittleexampletosetthesubject.SupposeacubefeatureFig.1whichiscomposedoftwotypesofgeometry:faces(6)andedges

5、(12).Onthisfeature,forthesetoffacesandforthesetofedges,graphicalpropertiesareput.Forfaces,itispossibletosetacolor,adegreeofopacityandforthelines,acolor,atypeandathickness.Fig.1:GraphicalPropertiesontheCubeFeatureTheprincipeofthegraphicalpropertiesliesonthefactthatanelement(afeature)containsoneorseve

6、ralsub-types.Asub-typeissortedbytypeofgeometry:point,line,surfacicetcandforeachsub-typeasetofgraphicalpropertiesisassociated.Tointegratetheminthevisualizationprocess,thereisthreemaininterfaces:CATIVisProperties,CATIPropertyetCATIVisu.CATIVisPropertiesenablestoassociategraphicalpropertiestoafeature,i

7、tusestheCATIPropertytoperpetuatethedata,itisusedbytheCATIVisutoupdatethegraphicalpropertiesofthegraphicalrepresentations.Fig.2:RelationshipBetweentheThreeInterfacesOnthisshema,youcanseethat:ThefeatureimplementsthethreeinterfacesCATIVisPropertiesisthecentralinterface.ThefeaturedoesntimplementtheCATIV

8、isuinterface,butaninterfacewhichC+derivesfromCATIVisu.Buttogeneralizethesubject,inthisarticle,onlytheCATIVisuinterfacewillbementioned.Youcannoticethatifthecomponantisnotafeature,itcanthavegraphicalpropertiesbecausetheCATIPropertyistouseAsIs.TheGraphicalPropertiesareGraphicalAttributesThegraphicalpro

9、pertiesarevisualproperties,itmeansthatthepropertiescanbedirectlyusebythevisualizationprocessus.Theseattributs,classifiedbystorageway,arethefollowing:Thegraphicattribute,theCATGraphicAttributeSetoThecolor,oThetypeoftheline(solid,dashed,.),oThethicknessoftheline,oThedegreeofopacity,oThevisibilitystate

10、(show/noshow)oTheselectionabilitestate(pick/nopick)oTheflagforthelowintcolorTheUsingGraphicAttributes1articleenablestofamiliarizeyouwiththisclass.TheGraphicPrimitive,aCATGraphicPrimitiveThemarkerofthepointissetattheCAT3DMarkeGPorCAT2DMarkerGPconstructionclass.Other:Thenumberofthelayer.Tospecifythety

11、peofthegraphicalproperties,thereistheCATVisPropertyTypeenum.CATVPColorforthecolorCATVPOpacitefortheopacityCATVPWidthforthelinewidth(thickness)CATVPLineTypeforthelinetypeCATVPSymbolforthesymbolofthemarkerCATVPShowfortheshow/noshowflagCATVPPickforthepick/nopickflagCATVPInheritancefortheinheritanceflag

12、CATVPLowIntforthelowintcolorflagCATVPLayerforthelayerAtthesevalues,ananotheronewhichdoesntrepresentapropertybutasetofproperties:CATVPAllProperties.Thedataforthegraphicalproperties(thecolor,theflag)willbewrite(read)onaCATVisPropertiesValues.ItsdetailedintheUsingCATIVisPropertiessection.TheTypesofGeom

13、etryTheinformationstoredontheCATIVisPropertiesisthetype(s)ofgeometrysupportedbythefeature.CATIAV5suppliessometypesofgeometry,thoseinrelationshipwiththedimensionofthesub-typeare:CATVPPoint(OD)CATVPLineforawireandCATVPEdgeforalineonasurface(1D)CATVPMeshforasurface(2D)ananotherisfortheassemblingmodels:

14、CATVPAsmAtthesefivevalues,thereisalastCATVPGlobalType.Thistyperegroupstogetherthegraphicalpropertiesindependantofthesub-types:thevisibilitystate,theselectionnabilitystate,thelowintcolorflagandthenumberofthelayer.Actuallyinfact,itisnotpossibletosetthepointsofawireonalayer,andsetitscurvesonanotherlaye

15、r.Itisthegloballytheelementwhichisonalayer.Thesesixtypes,CATVPPoint,CATVPLine,CATVPEdge,CATVPMesh,CATVPAsmandCATVPGlobalTypeareCATVisGeomTypeTheGraphicalPropertiesbyGeometryTypeToassociategraphicalpropertiesforatypeofgeometry,thereistheCATVisPropertiesValuesclass.Onaninstanceofthisclass,yousetthecol

16、or,thetypeofpointandsoon.OntheCATIPropertyinterface,acopyofthisinstanceisstored.So,apriori,youcansetanygraphicalpropertiesforanytypeofgeometry.Butatlast,onlythegraphicpropertiesinterpretablebytheprocessvisualizationareimportant.Itmeansthatyoucansetadegreeofopacityforyourlineicfeature,butthevisualiza

17、tionprocesscouldnottranslatethat.Thenextsectiondescribesthat.IntegrationoftheGraphicalPropertiesintheVisualizationProcessGeneralitesInthevisualizationprocess,therearetwocasestodistinguish,eventhoughtheyjointogetherattheend.Thetotalandthepartialrevisualizationofthemodel.Butatfirst,itisimportanttogive

18、themethodsoftheCATExtIVisuadapterclassoftheCATIVisuinterfaceinrelationshipwiththeproperties:virtualCATRep*BuildRep()virtualvoidSetGraphicAttribut()virtualintModifyRep(constCATNotification&iNotif)virtualvoidSetPointGraphicAttribute(CATRep*iRep,CATVisPropertyTypeiPropertyType,CATVisPropertiesValues&iP

19、ropertyValues)virtualvoidSetMeshGraphicAttribute(CATRep*iRep,CATVisPropertyTypeiPropertyType,CATVisPropertiesValues&iPropertyValues)virtualvoidSetLineGraphicAttribute(CATRep*iRep,CATVisPropertyTypeiPropertyType,CATVisPropertiesValues&iPropertyValuesvirtualvoidSetEdgeGraphicAttribute(CATRep*iRep,CATV

20、isPropertyTypeiPropertyType,CATVisPropertiesValues&iPropertyValues)virtualvoidSetAsmGraphicAttribute(CATRep*iRep,CATVisPropertyTypeiPropertyType,CATVisPropertiesValues&iPropertyValues)ThetotalrevisualizationofthemodelAftertheconstructionofthegraphicrepresentation(CATRepclass),realizedbytheBuildRepme

21、thod,theSetGraphicAttributmethodiscalled.Thedefaultimplementationofthismethod,thoseoftheCATExtIVisuadapterclass,callssuccessively(*)thefollowingmethods:1.Methodnotexposedtoprocesstheindependentpropertiesofthesub-elements:visibility,selectionability,layerandlowint(CATVPGlobalType)SetPointGraphicAttri

22、bute(CATVPPoint)SetLineGraphicAttribute(CATVPLine)SetMeshGraphicAttribute(CATVPMesh)SetEdgeGraphicAttribute(CATVPEdge)SetAsmGraphicAttribute(CATVPAsm)(*)Thesemethodsarecalledonlyifthetypeofgeometry,setinbracketinthepreviouslist,isdefinedbythefeature.TheSetGraphicAttributmethodcallsthesemethodswithCA

23、TVPAllPropertiesassecondargument.Itmeansthatallthegraphicalpropertiesaresetonthegraphicrepresentationforthegiventypeofgeometry.2.ThepartialrevisualizationofthemodelAfteraCATModifyVisPropertiesnotification,apartialrevisualizationofthemodelisdone.Infactonlythegraphicalpropertiesarechanged.Thisnotifica

24、tioncontainsthetypeofthegeometryanditsnewgraphicalproperties.TheModifyRepanalyzestheinputsnotification,andcallsoneofthesixmethodsconcernedbythetypeofgeometry.Thedifferencebetweenthetotalrevisualizationisthesecondargumentofthesemethods:itisnotnecessaryCATVPAllProperties,butcanbeoneoftheCATVisProperty

25、TypeenumerationasCATVPColorforexample.Inthetwocases,theprocessconvergestowardsthesamemethods.Theirgoalistomodifythegraphicrepresentation(andtheirassociatedgraphicattributes)intakenaccountofthegraphicpropertiessetontheCATVisPropertiesValuesinstance,thethirdargumentofthesemethods.Itisimportanttoknowwh

26、atdotheydointheirdefaultimplementation,becauseifthedefaultbehaviordoesntfityourneed,youwilldoreimplementthoseconcernedbythetypeofgeometrydefinedbyyourfeature.SeeImplementingCATIVisProperties.Beforetodetailthem,wehavedescribedthesecondandthethirdargumentofthesesixmethods,thereisstillthefirst.ItisaCAT

27、Reppointerwhichcomesfromthevisualizationprocess.Indeed,itisthegraphicrepresentationcreatedinyourBuildRepextension.DefaultBehaviorsoftheSetxxxGraphicAttributemethodsSetPointGraphicAttributeThegraphicalpropertiesprocessedarethecolorandthesymbolofthemarker.ThemethodtakescareonlytheCAT3DPointReportheCAT

28、2DPointRepclass.IfyourgraphicrepresentationisaCAT3DCustomRep,itwillbenecessarytoreimplementit.SetLineGraphicAttributeSeeSetEdgeGraphicAttributeSetMeshGraphicAttributeThegraphicalpropertiesprocessedarethecolorandthedegreeofopacity.IfthegraphicrepresentationisaCATSurfacicRep,thegraphicattributesofeach

29、faceswillbemodified,andalsothegraphicattributesassociatedtoeachlevelofdetail2.Otherwise,thegraphicattributeofthegraphicrepresentationischanged.SetEdgeGraphicAttributeThegraphicalpropertiesprocessedarethecolor,thetypeandthethicknessoftheline.Ifthegraphicrepresentationis:oaCATSurfacicRep,thegraphicatt

30、ributesofeachedgeswillbemodified,oaCAT3DCustomReporaCAT2DCustomRep,allthegraphicattributeswillbemodifiedootherwise,thegraphicattributeofthegraphicrepresentationischangedSetAsmGraphicAttributeThegraphicalpropertiesprocessedarethecolor,thetypeoftheline,thethickness,thedegreeofopacityandtheinheritance.

31、InshorttheStandardGraphicalPropertiesbyTypeofGeometryThissectiondescribesintableformTab.1foreachtypeofgeometry,thegraphicalpropertiestakenaccountbytheCATExtIVisumethodsthatwehavedetailedjustabove.Tab.1:TheGraphicPropertiesforEachTypeofGeometryThetypeoftheGeometryGraphicPropertiesCATVPGlobalTypeShow/

32、noshowstateNumberoflayerPick/nopickstateLowintcolorstateCATVPPointColorSymbolofthemarkerCATVPLineasedgeCATVPEdgeColorThicknessLinetypeCATVPMeshColorDegreeofopacityCATVPAsmInheritanceColorDegreeofopacityLinetypeThicknessAutomationInimplementingtheCATIVisPropertiesinterfaceonyourfeature,youbenefitauto

33、maticallyoftheCATIAVisPropertySetautomationinterface.TheinteractiveCommandsThePropertiesCommandIfyourfeatureimplementsCATIVisProperties,whenyoulaunchthePropertiesCommands,theGraphictabpageappears.Itscontentsdependsonthetypeofgeometrydefinedbythefeature.Therearethreepossiblecases:Inthecasewherethetyp

34、eofgeometryisCATVPPointand/orCATVPLineand/orCATVPEdgeand/orCATVPMesh(withorwithoutCATVPGlobalType):Fig.3:ThePropertiesDialogBox-Case1ColorTransparencyPointsColorColorLinetvp&Ihickriess11|1;-LinesandCurysColorLinetypeThickriessI11:JShowPickandLayersShcH/jnPickableLowlntThisisasamplewithafeaturewhicha

35、rethetypesCATVPGlobalTypeandCATVPPoint.Thispagecontainstwoframes:oThefirstiswithouttitle,butitcontainsthesub-frames:Fill,Edges,LinesandCurvesandPoints.Thisframeappearsifoneofthefollowingtypeofgeometryisdefinedbythefeature:CATVPPoint,CATVPLine,CATVPEdgeorCATVPMesh.Ifthetypeisnotsupportedbythefeature,

36、itsoptionsaredisable.Inthisexample,onlythepointproperties(colorandsymbol)areavailable.oThesecondwhosethetitleisShowPickandLayers,appearsonlyiftheCATVPGlobalTypetypeissupportedbythefeature.InthecasewherethetypeofgeometryisCATVPAsm(withorwithoutCATVPGlobalType):Thickriess:PicksNeLowlntJShowPickandLaye

37、rsShewnPropertiesFig.4:ThePropertiesDialogBox-Case2ProductjGraphicMechanicalNo.-ColorLinetypeGraphicPropertiesCclorTransparency9NoLineTypeCurrentselection:jPrcidijctHNciMidth二nel.ThisisanexamplewherethefeaturedefinedthetypesCATVPAsmandCATVPGlobalType.Thispagecontainstwoframes:oThefirsthasfortitleGra

38、phicPropertiesoThesecond,ShowPickandLayers,appearsonlyiftheCATVPGlobalTypetypeissupportedbythefeature.InthecasewherethetypeofgeometryisonlyCATVPGlobalType3PropertiesFig.5:ThePropertiesDialogBox-Case3Currentselection:|-ShowPickandLayersShownPickdbleIILowlntMechanical|Mas?jGraphicProductINoneOnlytheSh

39、owPickandLayersappears.TheGraphicPropertiesToolbarTheGraphicPropertiestoolbar,Fig.6isthefollowing:Fig.6:TheGraphicPropertiesToolbarToapplypropertiesfi-omaselectedfeatureWhenafeatureisselected,thetoolbarisupdatedintakenaccountofthefeaturesproperties.Ifseveralfeaturesareselected,thebehavioristhefollow

40、ing:Ifthereareseveralpossiblevaluesforacombo,thecombodisplaysundefined(likethecombocolorinthepreviouspictureFig.6)IftherearemorethanNfeaturesselected,allcombosareundefined.ThevalueNiscustomizablethroughtheTools/Options/Display/Navigationpage,intheLimitDisplaytoManipulatorsoption.Youcannoticethatinth

41、istoolbar,thereisonlyonecomboforeachtypeofproperty.AssumethatyourfeaturedefinedtheCATVPPointandtheCATVPLinetypes.Thesetwotypeshaveincommonthecolorproperty.Soachoicemustbedonetodefinethetypeconcernedbythecolorproperty.ItisthegoaloftheGetSubTypefromPathmethodoftheCATIVisPropertiesinterface.Thispointwi

42、llbedetailedintheImplementingCATIVisPropertiessection.TheHide/ShowCommandTheHide/Showcommandenablestohideorshowtheselectedfeatures.Buttobenefitofthisfunctionalityonyourfeature,itmustimplementtheCATISelectShowinterface.ItusestheCATIVisPropertiestomodifythevisibilitystateofthefeature.TopUsingCATIVisPr

43、opertiesIfthissectiondetailedtheusageoftheCATIVisPropertiesinterface,theModifyingObjectGraphicalPropertiesarticle3exposesaconcreteusecase.Thisinterfacecontainsfivemainmethods:GetPropertiesAtt(CATVisPropertiesValues&oValues,CATVisPropertyTypeiPropType,CATVisGeomTypeiGeomType)SetPropertiesAtt(CATVisPr

44、opertiesValues&iValues,CATVisPropertyTypeiPropType,CATVisGeomTypeiGeomType)ThefirstretrievesthepropertiesfromtheCATIPropertyinterfaceandthesecondmodifiesthemontheCATIPropertyinterfaceThesetwomethodsfunctiononthesameprinciple:thepropertyvaluesareontheCATVisPropertiesValuesinstanceandtwokeysoiGeomType

45、,precisesthetypeofthegeometryconcernedbythepropertyoiPropType,precisesthetypeofthepropertyvalidontheCATVisPropertiesValuesinstanceExample:Letschangethecolor(CATVPColorforthepropertytype)ofaline(CATVPLineforthegeometrytype)representedbythepLinepointer.CATIVisProperties*pIVisPropertiesOnLine=NULL;HRES

46、ULTrc=pLine-QueryInterface(IID_CATIVisProperties,(void*)&pIVisPropertiesOnLine);if(SUCCEEDED(rc)CATVisPropertiesValuesMyPropertyOnLine;MyPropertyOnPoint.SetColor(255,0,0);rc=pIVisPropertiesOnLine-SetPropertiesAtt(MyPropertyOnLine,CATVPColor,CATVPLine);.Atfirst,theCATVisPropertiesValuesinstance,MyPro

47、pertyOnLine,isvaluatedwiththecolorthankstotheSetColormethod.NextcallingtheSetPropertiesAttmethodmodifiesontheCATIPropertyinterfaceonlythecolorofthelinegeometrybecausethesecondargumentisCATVPColorandthethirdisCATVPLine.ResetPropertiesAtt(CATVisPropertyTypeiPropType,CATVisGeomTypeiGeomType)Thismethods

48、enablestoinvalidatethepropertysetontheCATIProperty.ItmeansthatatthenextGetPropertiesAttcalls,thereturnedpropertiesvalueswillbethestandardvalues.ThereturnedcodeoftheGetPropertiesAttmethod,S_AUTOMATIC,precisesthatthereturnedpropertiesvaluesisthestandard.Tosetnewspecificproperties,anewSetPropertiesAttw

49、illbenecessary.Example:Alwayswiththeline,pointedbypIVisPropertiesOnLine,thecoloroftheCATVPLinegeometrytypeisreseted.HRESULTrc=pIVisPropertiesOnLine-ResetPropertiesAtt(CATVPColor,CATVPLine);if(SUCCEEDED(rc)CATVisPropertiesValuesMyPropertyOnLine;rc=pIVisPropertiesOnLine-GetPropertiesAtt(MyPropertyOnLi

50、ne,CATVPColor,CATVPLine);if(S_AUTOMATIC=rc)elsecouterrorendl;Inthisexample,youcanseethataftertheResetPropertiesAttcall,forthesamekeyCATVPColorandCATVPLine,theGetPropertiesAttmethodreturnstheS_AUTOMATICvalue.ItmeansthatthecolorsetsontheMyPropertyOnLineinstance,isthestandardcolor,sothesamevalueasthose

51、returnedbytheGetStandardPropertiesmethodwiththesamekeys.Note:ifanySetPropertiesAttcallhasbeendoneonthefeature,ithasstandardvalues.GetStandardProperties(CATVisPropertiesValues&oValues,CATVisPropertyTypeiPropType,CATVisGeomTypeiGeomType)Thismethodretrievesthestandardproperties.Thesevaluesarethevaluesm

52、anagedbytheCATIVisPropertiesimplementationTab.2andarenotthestandardofcreationthatyoucanmanagewiththeSmand.Tab.2:ThestandardvaluesforeachtypeofpropertyThetypeofthepropertyThestandardvalueColorwhite(255,255,255)SymbolCrossThicknessofaline1TypeofalineSolidDegreeofopacity0Numberofthelayer0Caution:Thecon

53、tentsofthistablecanbedifferentbetweentwoimplementationsoftheCATIVisPropertiesinterface.TheDSfeatures,implementingtheGetStandardPropertiesmethods,haveperhapsanotherstandardvalues.HerethestandardvaluesdefinedbytheCATExtIVisPropertiesmethodsareexposed.IsGeomTypeDefined(CATVisGeomTypeiGeomType)Tellsifag

54、iventypeofgeometryisrecognizedbythefeature.TopImplementingCATIVisPropertiesIfthissectiondetailedtheimplementationoftheCATIVisPropertiesinterface,theImplementingCATIVisPropertiesarticleexposesaconcreteusecase.YouwillfindthisarticleintheProductProcessResouce(PPR)partoftheCAAencyclopedie.Toimplementthi

55、sinterfaceyouusetheCATExtVisPropertiesadapterclass.Therearetwomethodstooverwrite:IsGeomTypeDefinedItisthemethodtodefineoneorseveraltypeofgeometryforthefeature.HereisanexampleforafeaturewhichdefinedtheCATVPPointandtheCATVPGlobalTypetypes.HRESULTCAAEPstVisPropertiesPoint:IsGeomTypeDefined(CATVisGeomTy

56、pe&iGeomType)HRESULTrc=E_FAIL;if(CATVPPoint=iGeomType)|(CATVPGlobalType=iGeomType)rc=S_OK;returnrc;ThismethodreturnsS_OKwhenthetypeisvalidotherwiseE_FAIL.OverwriteornotthemethodsoftheCATExtIVisuadapterclassoftheCATIVisuinterfaceYouhavechosenoneorseveraltypesamongthefollowingtypes:CATVPPoint,CATVPLin

57、e,CATVPEdge,CATVPAsm,CATVPMiesh.ButinstudyingthedefaultbehaviorofthemethodsoftheCATExtIVisuclass,associatedateachtypeyouhavechosen,younotethattheirprocessdontfityourneed:thegraphicrepresentationofyourfeaturewillnotbecorrectlymodified.Takeanexample,thefeatureisawirewhichcontainslineicsub-elements(lines)andpointsThetypeofgeometryareCATVPPointandCATVPLine.SothemethodsoftheCATExtIVisuareSetPointGraphicAttributetomodifythepointsattributesandSetLin

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论